【发布时间】:2015-11-03 12:43:59
【问题描述】:
这是我的didEnterRegion 函数代码。问题是通知在进入和退出时触发。仅当用户输入位置时,我该怎么做才能触发通知?
func locationManager(manager: CLLocationManager!, didEnterRegion region: CLRegion!) {
var localNotification:UILocalNotification = UILocalNotification()
localNotification.alertBody = "you've entered rohini sector -8"
localNotification.region = region
UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
NSLog("Entering region")
}
【问题讨论】:
-
为什么要在本地通知中指定区域?自从您接到
didEnterRegion的电话后,您就已经知道他们在该地区,因此在通知上指定地区是多余的 -
@Paulw11thanx 人。不知道我怎么错过了这个。现在可以完美运行。
标签: ios swift notifications uilocalnotification region-monitoring