1

I would like to click a button in my iOS (11.3) app, which would open google maps at a particular location.

I have both id an place_id for my place but I don't know how to use them.

Here is the link that I constructed but it fails to open

world.location = "comgooglemaps://?q=place_id:\(place.1["place_id"].stringValue)&center=" + latlong;

GoogleMaps launches but it responds with "No results" for my place_id. Also, the place_id: is visible in the search bar in the app.

And this is how I attempt to open the link

@IBAction func search(_ sender: UIButton) {
   UIApplication.shared.open(URL(string : world.location)!)
}
Ando
  • 1,802
  • 4
  • 25
  • 47
  • How do you generate the location URL? – Alper Jun 06 '18 at 10:59
  • @Alper, sorry I thought it was clear from the question. I added the property name to the first code snippet. – Ando Jun 06 '18 at 11:04
  • Then please the result of that generation. – Alper Jun 06 '18 at 11:05
  • I don't see `id` and `place_id` in the documentation: https://developers.google.com/maps/documentation/urls/ios-urlscheme Where did you find yours? – Larme Jun 06 '18 at 11:06
  • @Larme, I couldn't find it in the docs page either but i thought it might be available since it is possible to click on businesses in the app and see details about them. Also I was steered to try the above code by reading the following answer (which has a comment for ios 11) - https://stackoverflow.com/a/46209135 – Ando Jun 06 '18 at 11:11

1 Answers1

0

Hi Ando go through the following link. I guess you will know the answer there, your URL is not right. URL - How do i open Google Maps for directions using coordinates on the iphone

Shivam Gaur
  • 491
  • 5
  • 16