简体   繁体   English

-canOpenURL:URL失败:“ testapp23://”-错误:“(null)”

[英]-canOpenURL: failed for URL: “testapp23://” - error: “(null)”

I get this error on real device: 我在真实设备上收到此错误:

-canOpenURL: failed for URL: "testapp23://app" - error: "(null)" -canOpenURL:URL失败:“ testapp23:// app”-错误:“(null)”

This is the code I use: 这是我使用的代码:

let openAnotherAppURL = NSURL(string: "testapp23://app")!     
if (UIApplication.sharedApplication().canOpenURL(openAnotherAppURL)) {
//some code
}

I added LSApplicationQueriesSchemes to my info.plist file 我已将LSApplicationQueriesSchemes添加到我的info.plist文件中

<key>LSApplicationQueriesSchemes</key>
<array>
     <string>testapp23</string>
</array>

And it seems to "recognise" the second apps scheme scheme, cause when I use something else like "testaapp23" I get a different error message (which makes sense): 而且似乎“识别”了第二个应用程序方案方案,原因是当我使用“ testaapp23”之类的东西时,我得到了另一条错误消息(这很有意义):

-canOpenURL: failed for URL: "testaapp23://app" - error: "This app is not allowed to query for scheme testaapp23" -canOpenURL:URL失败:“ testaapp23:// app”-错误:“此应用程序不允许查询方案testaapp23”

I have the second app installed on the device 我在设备上安装了第二个应用程序

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>testapp23</string>
        </array>
    </dict>
</array>

Am I missing something obvious? 我是否缺少明显的东西?

Try in target application in its Info.plist: 在其Info.plist中尝试目标应用程序:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>testapp23</string>
        </array>
    </dict>
</array>

I've created demo project with 2 target: source and target apps. 我创建了具有2个目标的演示项目:源和目标应用程序。 Everything working OK, when I run target, than source and checking canOpenURL: . 当运行目标时,一切正常,而不是源并检查canOpenURL:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 -canOpenURL:URL失败:“fbauth2:/” - 错误:“(null)” - -canOpenURL: failed for URL: “fbauth2:/” - error: “(null)” -canOpenURL:URL失败:“ spotify:”-错误:“(null)” - -canOpenURL: failed for URL: “spotify:” - error: “(null)” facebook登录问题 - canOpenURL:网址失败:“fbauth2:///” - 错误:“(null)” - facebook login issue - canOpenURL: failed for URL: “fbauth2:///” - error: “(null)” -canOpenURL:URL失败:“ fbauth2:/”-iOS 9错误:“(空)”(快速) - -canOpenURL: failed for URL: “fbauth2:/” - error: “(null)” for ios 9 (swift) iOS 9 Facebook登录模拟器-canOpenURL:URL失败:“ fbauth2:///”-错误:“(空)” - iOS 9 Facebook login simulator -canOpenURL: failed for URL: “fbauth2:///” - error: “(null)” 沉默“-canOpenURL:URL失败:” - Silence “-canOpenURL: failed for URL:” -canOpenURL:URL失败:“fbauth2:/”(OSStatus错误-10814。)“ - -canOpenURL: failed for URL: “fbauth2:/” (OSStatus error -10814.)" -canOpenURL:由于 facebook 和其他社交网络的 URL 错误而失败 - -canOpenURL: failed for URL error for facebook and other social networks canOpenURL:URL 失败:“instagram://”- 错误:“不允许此应用查询方案 instagram” - canOpenURL: failed for URL: "instagram://" - error: "This app is not allowed to query for scheme instagram" swift3 - canOpenURL:URL 电话失败 - swift3 - canOpenURL: failed for URL tel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM