我有一个SFSafariViewController打开在点击一个按钮在一个UIActionSheet。除了iOS 11之外,它一直运行良好,而且仍然运行良好。在iOS 11或Xcode 9.0中的SFSafariViewController方面,是否有什么改变可能导致了这个问题?
更新-所以它的Xcode 9.0似乎是造成这个问题的原因。我尝试过在不同的iOS版本上运行它,所有这些版本似乎都给出了这个问题。当我使用Xcode 8.3.3运行它时,它过去运行得很好,这是我再也没有的东西了:
这是密码-
- (void)presentWebView:(NSString *)url {
url = [url stringByReplacingOccurrencesOfString:@" " withString:@"+"];
url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *URL = [NSURL URLWithString:url];
if (URL) {
    if ([SFSafariViewController class] != nil) {
        SFSafariViewController *sfvc = [[SFSafariViewController alloc] initWithURL:URL];
        sfvc.delegate = self;
        [self.tabBarController presentViewController:sfvc animated:YES completion:nil];
    } else {
        if (![[UIApplication sharedApplication] openURL:URL]) {
            NSLog(@"%@%@",@"Failed to open url:",[url description]);
        }
    }
} else {
    // will have a nice alert displaying soon.
}}
发布于 2017-09-28 03:11:22
到目前为止,对我来说唯一起作用的是以以下方式使SafariViewController成为根视图控制器-
    ((XYZAppDelegate *)[UIApplication sharedApplication].delegate).window.rootViewController = self.svc;
    [((XYZAppDelegate *)[UIApplication sharedApplication].delegate).window makeKeyAndVisible];https://stackoverflow.com/questions/46439142
复制相似问题