【问题标题】:iOS8 keyboard Extension jump to another AppiOS8键盘扩展跳转到另一个App
【发布时间】:2015-03-09 20:28:35
【问题描述】:

当我想在 App1 中打开 App2 时,我可以这样做:

NSURL * myURL_APP_A = [NSURL URLWithString:@"openurl1://"];

if ([[UIApplication sharedApplication] canOpenURL:myURL_APP_A]) {

[[UIApplication sharedApplication] openURL:myURL_APP_A];

}

但是当我想在键盘扩展中打开一个应用程序时,[UIApplication sharedApplication]无法使用。那我该怎么做呢?

感谢您的帮助!

【问题讨论】:

    标签: ios8 custom-keyboard


    【解决方案1】:

    你可以试试这个方法:

    NSURL *url = [NSURL URLWithString:@"myapp://"]; 
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
    [self.view addSubview:webView];
    [webView loadRequest:urlRequest];
    

    【讨论】:

      【解决方案2】:

      [UIApplication sharedApplication] openURL 目前不允许在自定义键盘中使用。您应该会看到一条错误消息弹出,准确地告诉您。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-03-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-14
        • 1970-01-01
        相关资源
        最近更新 更多