如何添加20多个地理围栏本地通知?

时间:2015-06-13 08:16:35

标签: ios swift cocoa-touch uilocalnotification

我正在使用以下代码创建应用,以根据位置触发本地通知:

let locattionnotification = UILocalNotification()
locattionnotification.alertBody = "You have entered a high risk zone (Crown Range Road) , proceed with caution"
locattionnotification.regionTriggersOnce = false
locattionnotification.region = CLCircularRegion(circularRegionWithCenter: CLLocationCoordinate2D(latitude:
37.33182, longitude: -122.03118), radius: 100.0, identifier: "Location1")
UIApplication.sharedApplication().scheduleLocalNotification(locattionnotification)

此代码适用于20条警报消息,因为这是iOS中的限制。

我想做更多但是我不确定如何去做。

我听说您可以检测到何时进行了重要的位置更改,然后计算出距离最近点的距离并仅启用这些点。

有人可以向我提供有关我如何计算这些不同点的距离并仅启用相关点的建议和/或代码吗?

1 个答案:

答案 0 :(得分:0)

检查此答案是否存在类似问题:

Need to add more than 20 geofence regions

应该帮助你。让我知道是否有意义。