在 iOS 11 中,didEnterRegion 和 didExitRegion 在授予 authorizedWhenInUse 时不起作用,否则它可以正常工作
In iOS 11 didEnterRegion & didExitRegion not working when authorizedWhenInUse is granted otherwise its working fine
我从这里下载项目
https://www.raywenderlich.com/136165/core-location-geofencing-tutorial
并根据要求做了少量修改
xcode 说缺少描述所以我在 info.plist
中添加这些
隐私 - 位置始终和使用时使用说明
隐私 - 使用时的位置使用说明
在GeotificationsViewController
我修改了这个
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
mapView.showsUserLocation = 状态 == .authorizedAlways||状态 == .authorizedWhenInUse
}
当我授予 authorizedAlways
时,一切正常,但是当授予 authorizedWhenInUse
时,它没有提供 didEnterRegion
和 didExitRegion
应用已打开,运行,处于活动状态,在两种情况下都在屏幕上可见。
xcode 版本 9.2,
iOS11.2
对于基于区域的监控操作,您必须获得用户的 authorizedAlways
许可。
查看更多参考资料。
Apps cannot use any services that automatically relaunch the app, such
as region monitoring or the significant location change service.
我从这里下载项目
https://www.raywenderlich.com/136165/core-location-geofencing-tutorial
并根据要求做了少量修改
xcode 说缺少描述所以我在 info.plist
中添加这些隐私 - 位置始终和使用时使用说明
隐私 - 使用时的位置使用说明
在
GeotificationsViewController
我修改了这个func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) { mapView.showsUserLocation = 状态 == .authorizedAlways||状态 == .authorizedWhenInUse }
当我授予 authorizedAlways
时,一切正常,但是当授予 authorizedWhenInUse
时,它没有提供 didEnterRegion
和 didExitRegion
应用已打开,运行,处于活动状态,在两种情况下都在屏幕上可见。
xcode 版本 9.2, iOS11.2
对于基于区域的监控操作,您必须获得用户的 authorizedAlways
许可。
查看更多参考资料。
Apps cannot use any services that automatically relaunch the app, such as region monitoring or the significant location change service.