thomasdao
thomasdao

Reputation: 982

Get short Google Map URL to share in iOS

I have latitude, longitude of the center of map view and zoom of the view. How can I generate the URL like this https://goo.gl/maps/twqcy in iOS? So that I can send my friend message like this: "Please go to this place: https://goo.gl/maps/twqcy".

I searched for the answer, and here is what I got: I can build a string like: https://www.google.com/maps/place/@20.982375,105.7903495,17z to send to my friends.

However, there are 2 issues:

1) When user tap/click in the link, I want to show a marker. Currently it only center at the point with certain zoom degree that I put in. How can I generate a link, so that when my friend click on the link, he will see a marker?

2) How to change the form of the url to shortened one i.e from https://www.google.com/maps/place/@20.982375,105.7903495,17z to https://goo.gl/maps/twqcy.

Please answer with code in iOS, preferably in Swift.

UPDATE: This answer my question: Get url shortened with Google API, AFNetworking in Swift

Upvotes: 1

Views: 956

Answers (1)

aBilal17
aBilal17

Reputation: 3152

returns directly a shortened NSURL https://github.com/H2CO3/Shortener/blob/master/NSURL+Shortener.m

Upvotes: 1

Related Questions