小编edu*_*lpn的帖子

iOS 8.3共享扩展 - 启动URL方案

自iOS 8.3更新我的共享扩展(使用URL Schemes调用我的主应用程序)停止工作.所以我发现我必须启动我的应用程序的UIWebView方法不再适用.我也尝试过Apple推荐的方法,使用NSExtensionContext,但仍然没有结果.有什么想法吗?我的代码如下:

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
[self.view addSubview: webView];
NSString *urlString = "com.myappscheme://shareextension";
NSString * content = [NSString stringWithFormat : @"<head><meta http-equiv='refresh' content='0; URL=%@'></head>", urlString];
[webView loadHTMLString:content baseURL:nil];
Run Code Online (Sandbox Code Playgroud)

[self.extensionContext openURL:[NSURL URLWithString:urlString] completionHandler:^(BOOL success)
{
    NSLog(@"fun=%s after completion. success=%d", __func__, success);
}];
Run Code Online (Sandbox Code Playgroud)

我尝试从我的SLComposeServiceViewController控制器执行didSelectPost方法的两个代码块,这是之前它工作正常,然后将我的设备更新到iOS 8.3

objective-c ios ios8-share-extension ios-urlsheme ios8.3

5
推荐指数
1
解决办法
1459
查看次数