How to open google maps app with a dropped pin ? - Swift

前端 未结 9 1999
无人共我
无人共我 2020-12-31 09:26

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         


        
9条回答
  •  忘掉有多难
    2020-12-31 10:01

    You can use this:

    if (UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!)) {
        UIApplication.shared.openURL(URL(string:"comgooglemaps://?center=\(self.location.coordinate.latitude),\(self.location.coordinate.longitude)&zoom=14&views=traffic&q=\(self.location.coordinate.latitude),\(self.location.coordinate.longitude)")!)
    } else {
        print("Can't use comgooglemaps://")
    }
    

提交回复
热议问题