【发布时间】:2018-12-04 08:32:24
【问题描述】:
当我在 iPhone 上打开飞行模式时,
func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion)
不再被调用。但是,当我关闭飞行模式时,会调用此委托。
在 CLLocationManager 中这是正常的吗?或者我的属性设置错误。
我已经设置了所有属性。
lazy var locationManager: CLLocationManager = {
let lm = CLLocationManager()
lm.allowsBackgroundLocationUpdates = true
lm.pausesLocationUpdatesAutomatically = false
lm.showsBackgroundLocationIndicator = true
lm.delegate = self
lm.requestAlwaysAuthorization()
let authorizationStatus = CLLocationManager.authorizationStatus()
for region in lm.monitoredRegions {
lm.stopMonitoring(for: region)
}
return lm
}()
和locationManager.startMonitoring(for: region)
【问题讨论】:
标签: ios iphone swift core-location cllocationmanager