I have this code to open Google Maps App with specific location and it\'s working but what I need is to drop a pin on that location, is it possible ?
if (UIA
You should add this line in info.Plist file
LSApplicationQueriesSchemes
googlechromes
comgooglemaps
code here:
if dicDetails.hasValueForKey("latitude") && dicDetails.hasValueForKey("latitude") {
if (UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!)) {
if #available(iOS 10.0, *) {
UIApplication.shared.open(URL(string:"comgooglemaps://?center=\(dicDetails.stringValueForKey("latitude")),\(dicDetails.stringValueForKey("longitude"))&zoom=14&views=traffic&q=\(dicDetails.stringValueForKey("latitude")),\(dicDetails.stringValueForKey("longitude"))")!, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]), completionHandler: nil)
} else {
// Fallback on earlier versions
//https://www.google.com/maps/@
UIApplication.shared.openURL(URL(string:"https://www.google.com/?q=\(dicDetails.stringValueForKey("latitude")),\(dicDetails.stringValueForKey("longitude")),15z")!)
}
} else {
//print("Can't use comgooglemaps://")
UIApplication.shared.openURL(URL(string:"https://www.google.com/?q=\(dicDetails.stringValueForKey("latitude")),\(dicDetails.stringValueForKey("longitude")),15z")!)
}
}