【问题标题】:location based alarm/notification ios基于位置的警报/通知 ios
【发布时间】:2015-05-31 21:22:27
【问题描述】:

我正在构建一个iOS 应用程序,但是我想获得可能是本地和简单通知的通知,例如在定义的位置区域,以便提供latitudelongitude 来获取200meter 周围的区域,当用户进入该位置时,它会提醒通知。

如何在iOS 中安排基于location 的本地通知。

【问题讨论】:

标签: ios notifications location cllocationmanager uilocalnotification


【解决方案1】:

查看 SetSDK https://cocoapods.org/pods/SetSDK 中的可用功能。每当用户到达新的“位置”(由 sdk 动态了解)时,您都可以收到通知,然后快速评估它是否是您关心的位置。所以它看起来像这样,

SetSDK.instance.onArrival(to: .any) { newArrival in
    /* Compare the new location with the one of interest */
    if newArrival.location.distance(from: placeOfInterest) < 200 {
      /* do your things here */
    }
}

【讨论】:

    【解决方案2】:

    CLRegion 与背景位置结合使用,您的应用将在用户进入该区域时被唤醒。从那里您可以安排UILocationNotification 立即显示。

    【讨论】:

    • 你能用示例代码详细说明一下吗,我有一个纬度和一个经度,我想获得那个地区的本地通知。
    猜你喜欢
    • 2018-01-27
    • 1970-01-01
    • 1970-01-01
    • 2015-02-27
    • 1970-01-01
    • 2016-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多