Google maps URL scheme not working on iOS 9.1
I think currently you don't add google map scheme to whitelist.
You can reference to this question.
Whitelist
URL Schemes Not Working For native Maps App In iOS 9
As mentioned by rmaddy
LSApplicationQueriesScheme
is only needed to callcanOpenURL:
, 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.
Google Maps iOS street view URL scheme not working?
This has been fixed in the latest release of google maps iOS app. Please check it.
Reference : https://github.com/googlemaps/OpenInGoogleMaps-iOS/issues/6
Url schema for launching Google maps throwing Warning in iOS 9 and also not working
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)
How do I open google maps app via my app in iOS 9?
Add LSApplicationQueriesSchemes
as an array into your plist
and then add any scheme url you need into as a string.
What if Google Maps Url Scheme is Already registered by Another App
There's nothing your app can do. If two apps register the same custom URL scheme, iOS will open one of them. A third app has no way to know that there is more than one app with the same registered URL scheme. A third app simply makes the request. It can't know which of the two is actually launched nor can it specify which of the two to launch.
None of this is specific to the Goole Maps custom URL scheme. Sadly, Apple makes no attempt to ensure that apps have a unique custom URL scheme.
Cant open google maps from my native ios app with url comgooglemaps-x-callback://
You can open google maps using comgooglemaps://
only.
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]]) {
NSString* url = [NSString stringWithFormat: @"comgooglemaps://?daddr=%@&directionsmode=driving", encodedString];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: url] options:@{} completionHandler:^(BOOL success) {
if (success) {
//do something on success
}
}];
} else {
//if google map is not installed in device then we can open goole map in web
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://maps.google.com/maps?daddr=%@", encodedString]] options:@{} completionHandler:^(BOOL success) {
if (success) {
//do something on success
}
}];
}
Don't forget to include in Info.plist
like below.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>comgooglemaps</string>
</array>
Related Topics
How to Query Nearest Users in Firebase with Swift
What's Wrong Here: Instance Member Cannot Be Used on Type
JSON Parsing Using Nsjsonserialization in iOS
How to Write Output of Augraph to a File
Apple Push Notification Service Server Certificate Update
How to Call Https Url in Uiwebview
How to Change Tint Color of Uialertcontroller
Locking Orientation Does Not Work on iPad iOS 8 Swift Xcode 6.2
Navigationcontroller.Navigationitem VS Navigationitem
Document Directory Path Change When Rebuild Application
Visually Modifying a Uitoolbar from Xcode Storyboard
Drawing with Cgpath to Svg Output
Clip Image to Square in Swiftui
Perform Segue from App Delegate Swift
Uitableview Strange Layout Behavior Changes on Scroll
Set<Nsobject>' Does Not Have a Member Named 'Anyobject." - Xcode 6.3