16

The following URL scheme was working on previous version but doesn't work anymore on 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?

ChikabuZ
  • 10,031
  • 5
  • 63
  • 86
NoK
  • 171
  • 1
  • 1
  • 3

2 Answers2

31

In iOS 9, Apple has made a change to the handling of URL schemes. Now you need to add "LSApplicationQueriesSchemes" key in plist and then add URLScheme you want to call.

<key>LSApplicationQueriesSchemes</key>
<array>
 <string>comgooglemaps</string>
</array> 
ChikabuZ
  • 10,031
  • 5
  • 63
  • 86
Janu Gandhi
  • 430
  • 3
  • 8
  • 4
    I've added this but i still get the error message "-canOpenURL: failed for URL: "comgooglemaps://" - error: "This app is not allowed to query for scheme comgooglemaps"" – Don Alejandro Dec 09 '15 at 02:39
19

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. These schemes as comgooglemaps, comgooglemaps-x-callback, and your own app's custom URL scheme.

I have added following items in my info.plist.

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

Try with this sample code OpenInGoogleMaps-iOS.

Meet Doshi
  • 4,241
  • 10
  • 40
  • 81