Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Url schema for launching Google maps throwing Warning in iOS 9 and also not working

Following code was working fine with iOS 8.4 and earlier, but from iOS 9.0 it starts throwing warning as well giving false always.

[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps-x-callback://"]]

It is throwing warning as:

-canOpenURL: failed for URL: "comgooglemaps-x-callback://" - error: "This app is not allowed to query for scheme comgooglemaps-x-callback"

Do anyone having any idea about, why it is failing in iOS 9 and why throwing error as This app is not allowed to query for scheme comgooglemaps-x-callback, is there any permissions required to query it?

EDIT

I have added following items in my info.plist, but it is still having same problem.

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>comgooglemaps</string>
    <string>comgooglemaps-x-callback</string>
</array>
like image 411
Mehul Thakkar Avatar asked Oct 21 '15 06:10

Mehul Thakkar


1 Answers

You have to add a LSApplicationQueriesSchemes entry to your Info.plist and list the schemes that you want your app to query.

<key>LSApplicationQueriesSchemes</key>
<array>
     <string>urlscheme</string>
     <string>urlscheme2</string>
     <string>urlscheme3</string>
     <string>urlscheme4</string>
</array>

see http://useyourloaf.com/blog/querying-url-schemes-with-canopenurl.html (also contains a Link to the corresponding WWDC15-Session-Video)

like image 102
Martin Schneider Avatar answered Sep 26 '22 00:09

Martin Schneider