I have telprompt alert dialog in my application. I am running in iOS 10.1.1 and iPhone 7 device. Before showing dialog I need to display one view which is hiden in view controller but in iPhone 7 it is not display till I take any action on teleprompt. Below is the code which is working fine on other iOS. Your help would be appreciated.
[callView setHidden:NO];
NSString *phoneNumber = [@"telprompt://" stringByAppendingString:msg];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
It has nothing to do with the iPhone 7. It has to do with the version of iOS.
One simple solution is to delay the call to openURL:
to give your code a chance to complete the hiding of the callView
.
[callView setHidden:NO];
dispatch_async(dispatch_get_main_queue(), ^{
NSString *phoneNumber = [@"telprompt://" stringByAppendingString:msg];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
});
You should also note that the UIApplication openURL:
method is deprecated as of iOS 10. It has been replaced with openURL:options:completionHandler:
. Under iOS 10, using this new method may be another way to solve your issue. See https://stackoverflow.com/a/39767062/1226963 for a good explanation of how to use both versions of openURL:
depending on the current iOS version of the device.