Jekil Patel
Jekil Patel

Reputation: 403

URL Schemes Not Working For native Maps App In iOS 9

I need to open native iOS maps app from my app using below code:

 NSString *urladdress = [NSString stringWithFormat:@"http://maps.apple.com/?q=%@",@"Texas,US"];
    NSURL *url = [NSURL URLWithString:urladdress];
    [[UIApplication sharedApplication] openURL:url];

And I have also configured .plist as shown in below image

enter image description here

When I run my code I found following error in my console as shown in below image

enter image description here

I have searched a lot of similar links in stack overflow like

iOS 9 safari iframe src with custom url scheme not working

iOS 9 custom URL scheme not working

Google Maps URL scheme not working on iOS 9

but I am not able to solve my issue.

I would like to request you all to solve my query or show me the right path whether I am going on wrong direction. IF any example in stack or in somewhere else which I have missed to refer please let me know.

Upvotes: 0

Views: 458

Answers (1)

Vin
Vin

Reputation: 10548

As mentioned by rmaddy

LSApplicationQueriesScheme is only needed to call canOpenURL:, not openURL:

Even if you were using canOpenURL:, it would not be required to add LSApplicationQueriesScheme in the Info.plist for invoking the native maps app.

There seems to be a problem with the parameteres of the URL that you are forming to invoke Maps app. Try using one of the URLs mentioned in the documentation.

For example, you could use this.

Upvotes: 2

Related Questions