Meh*_*kar 7 google-maps objective-c url-scheme ios ios9
以下代码在iOS 8.4及更早版本中运行良好,但是从iOS 9.0开始,它false始终会发出警告.
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps-x-callback://"]]
Run Code Online (Sandbox Code Playgroud)
警告如下:
-canOpenURL: failed for URL: "comgooglemaps-x-callback://" - error: "This app is not allowed to query for scheme comgooglemaps-x-callback"
Run Code Online (Sandbox Code Playgroud)
有没有人知道,为什么它在iOS 9中失败以及为什么抛出错误This app is not allowed to query for scheme comgooglemaps-x-callback,是否需要查询它的任何权限?
编辑
我在info.plist中添加了以下项目,但它仍然存在同样的问题.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>comgooglemaps</string>
<string>comgooglemaps-x-callback</string>
</array>
Run Code Online (Sandbox Code Playgroud)
您必须在Info.plist中添加LSApplicationQueriesSchemes条目,并列出您希望应用程序查询的方案.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>urlscheme</string>
<string>urlscheme2</string>
<string>urlscheme3</string>
<string>urlscheme4</string>
</array>
Run Code Online (Sandbox Code Playgroud)
请参阅http://useyourloaf.com/blog/querying-url-schemes-with-canopenurl.html(还包含指向相应WWDC15-Session-Video的链接)
| 归档时间: |
|
| 查看次数: |
3538 次 |
| 最近记录: |