[英]-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.