简体   繁体   English

Google Maps URL方案不适用于iOS 9

[英]Google Maps URL scheme not working on iOS 9

The following URL scheme was working on previous version but doesn't work anymore on iOS 9: 以下URL方案在以前的版本上有效,但在iOS 9上不再起作用:

comgooglemaps://?q=Google+Japan,+Minato,+Tokyo,+Japan&center=35.660888,139.73073&zoom=15&views=transit

Did something change on iOS 9 that prevent apps from opening other apps using URL schemes? iOS 9上是否发生了一些更改,阻止了应用使用URL方案打开其他应用?

In iOS 9, Apple has made a change to the handling of URL schemes. 在iOS 9中,Apple对URL方案的处理进行了更改。 Now you need to add "LSApplicationQueriesSchemes" key in plist and then add URLScheme you want to call. 现在,您需要在plist中添加“ LSApplicationQueriesSchemes”键,然后添加要调用的URLScheme。

<key>LSApplicationQueriesSchemes</key>
<array>
 <string>comgooglemaps</string>
</array> 

In iOS 9.0, further restrictions were placed on the canOpenURL method -- for this method to work, you will need to add a LSApplicationQueriesSchemes array to your app's info.plist file, and then add items for each URL scheme you will want to query. 在iOS 9.0中,对canOpenURL方法施加了进一步的限制-为了使此方法起作用,您需要将LSApplicationQueriesSchemes数组添加到应用程序的info.plist文件中,然后为要查询的每个URL scheme添加项目。 These schemes as comgooglemaps , comgooglemaps-x-callback , and your own app's custom URL scheme. 这些方案为comgooglemapscomgooglemaps-x-callback和您自己的应用程序的自定义URL方案。

I have added following items in my info.plist. 我在info.plist中添加了以下项目。

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>comgooglemaps</string>
    <string>comgooglemaps-x-callback</string>
</array>

Try with this sample code OpenInGoogleMaps-iOS . 尝试使用此示例代码OpenInGoogleMaps-iOS

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM