update two deprecated methods to up-to-date version#364
update two deprecated methods to up-to-date version#364haowei-zhang wants to merge 1 commit intopokeb:masterfrom
Conversation
…ollerAnimated: & presentModalViewController:animated:
|
Thanks for suggesting this. I think the new methods are only available on iOS 5 and upwards unfortunately, and my understanding is ASIHTTPRequest is currently aiming to work on iOS 3 upwards. |
|
(I don't know if it might be appropriate to add ifdefs around your change somehow, or perhaps to use pragma's to silence the warnings - it's definitely not good that we have warnings appearing!) |
|
Yep, that's right~ No warnings, right?~Um, according to the message from xcode, it is used after ios 6.0. So I think it might be good if checks like[[UIDevice currentDevice] systemVersion] are done? (I don't know if it might be appropriate to add ifdefs around your change somehow, or perhaps to use pragma's to silence the warnings - it's definitely not good that we have warnings appearing!) ¡ª |
|
No, it's not a good idea to check the system version. You could, though, check at run-time if the object responds to a particular message (the new method name) like this: if ([viewController respondsToSelector:@selector(dismissModalViewControllerAnimated:completion:)])
[viewController dismissModalViewControllerAnimated:YES completion:nil];
else
[viewController dismissModalViewControllerAnimated:YES]; |
|
Ah! Right, this is a pretty good idea. Thanks for the advice~ Date: Mon, 27 May 2013 21:51:23 -0700 No, it's not a good idea to check the system version. You could, though, check at run-time if the object responds to a particular message (the new method name) like this: if ([viewController respondsToSelector:@selector(dismissModalViewControllerAnimated:completion:)]) ¡ª |
|
Sure! |
update deprecated method to up-to-date version, dismissModalViewControllerAnimated: & presentModalViewController:animated:, to dismissViewControllerAnimated:completion: & presentViewController:animated:completion:.