【问题标题】:How to send a location from my app to other apps in swift?如何快速将我的应用程序中的位置发送到其他应用程序?
【发布时间】:2017-11-24 01:36:25
【问题描述】:

我的应用中有一个位置。我想制作一个按钮,将此位置发送到其他应用程序,如谷歌地图或 waze。我该怎么做?

【问题讨论】:

标签: swift location mapkit


【解决方案1】:

像您在图像中添加的那样创建一个 ActionSheet。

对于列表中的所有应用程序,例如 GoogleMaps、Maps、Waze 点击后执行以下操作..

BOOL canHandle = [[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"comgooglemaps:"]];

if (canHandle) {
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 {

 //show alert to install googlemaps

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-06-10
    • 1970-01-01
    • 2017-06-16
    • 1970-01-01
    • 1970-01-01
    • 2016-02-07
    • 2020-03-10
    相关资源
    最近更新 更多