【问题标题】:Swift 3 Send Location as iMessageSwift 3 将位置作为 iMessage 发送
【发布时间】:2016-11-16 22:00:05
【问题描述】:

我制作了一个经典的“查找我的汽车应用程序”,它可以保存地图位置并导航回那里。我现在想实现一个分享按钮,通过 iMessage 发送保存的位置。

我已经设置了一个 MFMessageComposeViewController,以便发送带有坐标的消息体。

使用 URL 方法,如:http://maps.apple.com/?ll=40.730610,-73.935242" 确实有效,并打开地图应用程序。我缺少的是消息中的地图缩略图。

从 iMessage 或地图共享我的位置时,我会看到一个漂亮的小地图预览,消息中带有红色大头针。 在 Mac 上复制 iMessage 链接显示它是作为 VCF 卡发送的,但我发现无法通过 iMessage 发送 VCF 格式的链接。

有人知道如何让地图预览工作吗?

希望我的问题足够清楚!

谢谢

【问题讨论】:

    标签: ios maps swift3 imessage


    【解决方案1】:

    使用它来创建 VCF 文件:https://gist.github.com/naturaln0va/e1fed3f1d32ecf951aac

    比:

    MFMessageComposeViewController ().addAttachmentURL(Global.locationVCardURLFromCoordinate(coordinate: CLLocationCoordinate2D(latitude: 30, longitude: 40))!, withAlternateFilename: "vCard.loc.vcf")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-14
      • 2017-12-04
      相关资源
      最近更新 更多