![](/img/trans.png)
[英]-canOpenURL: failed for URL: “fbauth2:/” - error: “(null)”
[英]-canOpenURL: failed for URL: “testapp23://” - error: “(null)”
我在真实设备上收到此错误:
-canOpenURL:URL失败:“ testapp23:// app”-错误:“(null)”
这是我使用的代码:
let openAnotherAppURL = NSURL(string: "testapp23://app")!
if (UIApplication.sharedApplication().canOpenURL(openAnotherAppURL)) {
//some code
}
我已将LSApplicationQueriesSchemes添加到我的info.plist文件中
<key>LSApplicationQueriesSchemes</key>
<array>
<string>testapp23</string>
</array>
而且似乎“识别”了第二个应用程序方案方案,原因是当我使用“ testaapp23”之类的东西时,我得到了另一条错误消息(这很有意义):
-canOpenURL:URL失败:“ testaapp23:// app”-错误:“此应用程序不允许查询方案testaapp23”
我在设备上安装了第二个应用程序
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>testapp23</string>
</array>
</dict>
</array>
我是否缺少明显的东西?
在其Info.plist中尝试目标应用程序:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>testapp23</string>
</array>
</dict>
</array>
我创建了具有2个目标的演示项目:源和目标应用程序。 当运行目标时,一切正常,而不是源并检查canOpenURL:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.