My app freezes after calling openURL
on iOS 9.3 builds 13E233 & 13E234.
I tried using dispatch_after
but that does not fix the issue.
Here's the code, nothing special.
+ (void)someMethod:(UIView *)senderView {
[Utility showLoadingHUDWithText:nil inView:senderView];
[[SomeClient sharedClient] someNetworkAPI:^(id result) {
[Utility hideAllHUDsForView:senderView];
NSDictionary *dict = (NSDictionary *)result;
NSString *someString = dict[@"someKey"];
NSURL *url = [NSURL URLWithString:someString];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
} fail:^(NSError *error) {
[Utility hideAllHUDsForView:senderView];
[Utility showMessageHUD:error.localizedDescription];
}];
}
It seems like an iOS bug, many other apps affected, too.
I faced the same issue on iPad Air 2 / 3 running iOS 9.3.5 and JAL's answer did not solve the problem for me.
The code below works like charm.
This indeed causes a deadlock when being called on the main thread on iOS 9.3 (tested on an iPhone 6 and iPhone 6 Plus).
Backtrace:
I found that wrapping the entire call in a
dispatch_async
block fixed the issue:I would file a Radar with Apple and post it on Open Radar.
Looks like this was fixed with iOS 9.3.1: