OpenUrl freezes app for over 10 seconds

前端 未结 11 967
孤街浪徒
孤街浪徒 2020-12-13 02:05

I\'m currently developing an App, that needs to open a browser to display a webpage. To do that i use the [UIApplication sharedApplication] openURL method with

11条回答
  •  感情败类
    2020-12-13 02:26

    I found it will get better to use this since iOS 10.

    dispatch_async(dispatch_get_main_queue(), ^{
        if ([[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."].firstObject integerValue] < 10) {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:..."]];
        } else {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:..."] options:@{} completionHandler:^(BOOL success) {
    
            }];
        }
    });
    

提交回复
热议问题