iOS8键盘扩展跳转到另一个应用程序
当我想在App1中打开App2时,我可以这样做:iOS8键盘扩展跳转到另一个应用程序,ios8,custom-keyboard,Ios8,Custom Keyboard,当我想在App1中打开App2时,我可以这样做: NSURL * myURL_APP_A = [NSURL URLWithString:@"openurl1://"]; if ([[UIApplication sharedApplication] canOpenURL:myURL_APP_A]) { [[UIApplication sharedApplication] openURL:myURL_APP_A]; } 但是,当我想在键盘扩展中打开应用程序时,[UIApplication s
NSURL * myURL_APP_A = [NSURL URLWithString:@"openurl1://"];
if ([[UIApplication sharedApplication] canOpenURL:myURL_APP_A]) {
[[UIApplication sharedApplication] openURL:myURL_APP_A];
}
但是,当我想在键盘扩展中打开应用程序时,[UIApplication sharedApplication]无法使用。那么我如何才能做到这一点呢
谢谢你的帮助 [UIApplication sharedApplication]自定义键盘中当前不允许使用openURL。您应该会看到弹出一条错误消息,确切地告诉您这一点。您可以尝试以下方法:
NSURL *url = [NSURL URLWithString:@"myapp://"];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
[self.view addSubview:webView];
[webView loadRequest:urlRequest];