How to invoke iPhone Maps for Directions with Current Location as Start Address

后端 未结 16 1659
一整个雨季
一整个雨季 2020-12-02 03:53

I know it\'s possible to start the iPhone maps application by calling openURL on a google maps URL with parameters saddr and daddr wit

16条回答
  •  伪装坚强ぢ
    2020-12-02 04:29

    If you don't provide source location, it will take current location as source. Try below code-

    let urlString = "http://maps.apple.com/maps?daddr=(destinationLocation.latitude),(destinationLocation.longitude)&dirflg=d" }

    UIApplication.shared.openURL(URL(string: urlString)!)

提交回复
热议问题