飞行模式开启时,CLLocationManager如何获取位置 [英] how is it that CLLocationManager gets a location when Airplane Mode is ON
问题描述
我的应用程序使用CLLocationManager从设备获取位置更新。
My app uses CLLocationManager to get location updates from the device.
我假设设备处于飞行模式时,我不会获得位置更新。但是我愿意。
I had assumed that when the device was in Airplane Mode, I would not get location updates. But I do.
我之所以认为这是因为苹果公司表示飞机模式会关闭Wifi,蜂窝,蓝牙和GPS。请参阅: http://support.apple.com/kb/ht1355
The reason I assumed this is because Apple says that Airplane mode turns off Wifi, Cellular, Bluetooth, and GPS. See: http://support.apple.com/kb/ht1355
那么,如何使用看来合理的坐标来获取位置更新?
So, how is it that I'm getting a location update with a coordinate that seems reasonable?
推荐答案
我已经开发了一个大量使用用户位置的应用程序,因此必须检查这种情况和其他情况。
I've developed an app that heavily uses the user location, so I had to check this and other situations.
我了解到,当所有服务都关闭时(蓝牙,Wi-Fi,蜂窝数据),
CLLocationManager返回最新的已知位置,因此,在这种情况下,即使设备处于飞行模式,它也会返回一个位置。
I've learned that when all the services are off (Bluetooth, Wi-Fi, Cell Data) CLLocationManager returns the latest known location, so, in this case, even if the device in Airplane mode it will return a location.
您可以尝试获取位置信息,打开飞行模式,然后再远离那里,再询问位置。
You can try this by getting your location, turn Airplane mode on and then go far from there, ask the location again.
TL; DR:不是。它返回最新的已知位置。
TL; DR: It doesn't. It returns the latest known location.
这篇关于飞行模式开启时,CLLocationManager如何获取位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!