In my application, I need to submit a view controller. The 6.0 method for presenting a view controller is presentViewController: animated: completion :. I also want to support 4.3. In 4.3, the method to be called is ModalViewController: animated :. So I use responsesToSelector: to find out if this method is supported. But when I compile the application for version 6.0, it gives a warning message like
presentModalViewController: animated: deprecated: deprecated first in iOS 6.0
Does anyone know how to get rid of this warning. I also do not have a 4.3 device to check if it works. I need to assume that the code I'm writing should work on 4.3.
if([myViewController respondsToSelector:@selector(presentModalViewController:animated:)]){
[myViewController presentModalViewController:anotherViewController animated:YES];
}else{
[myViewController presentViewController:anotherViewController animated:YES completion:nil];
}
source
share