(IOS)解决openUrl延时问题
2018-08-09 本文已影响0人
rightmost
// 方法一
dispatch_async(dispatch_get_main_queue(), ^{
UIApplication *application = [UIApplication sharedApplication];
if([application respondsToSelector:@selector(openURL:options:completionHandler:)]) {
[application openURL:URL options:@{}
completionHandler:nil];
}else{
[application openURL:URL];
}
});
// 方法二
[selfperformSelector:@selector(redirectToURL:) withObject:url afterDelay:0.1];
- (void) redirectToURL
{
UIApplication *application = [UIApplication sharedApplication];
if([applicationrespondsToSelector:@selector(openURL:options:completionHandler:)]) {
[application openURL:URL options:@{}
completionHandler:nil];
}else{
[application openURL:URL];
}
}