简体   繁体   English

飞行模式开启时,CLLocationManager如何获取位置

[英]how is it that CLLocationManager gets a location when Airplane Mode is ON

My app uses CLLocationManager to get location updates from the device. 我的应用程序使用CLLocationManager从设备获取位置更新。

I had assumed that when the device was in Airplane Mode, I would not get location updates. 我以为,当设备处于飞行模式时,我不会获得位置更新。 But I do. 但是我愿意。

The reason I assumed this is because Apple says that Airplane mode turns off Wifi, Cellular, Bluetooth, and GPS. 我之所以认为这是因为Apple表示“飞行模式”会关闭Wifi,蜂窝,蓝牙和GPS。 See: http://support.apple.com/kb/ht1355 请参阅: 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. 我已经开发了一个大量使用用户位置的应用程序,因此必须检查这种情况和其他情况。

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. 我了解到,当所有服务都关闭时(蓝牙,Wi-Fi,蜂窝数据),CLLocationManager将返回最新的已知位置,因此,在这种情况下,即使处于飞行模式的设备也将返回位置。

You can try this by getting your location, turn Airplane mode on and then go far from there, ask the location again. 您可以尝试获取位置信息,然后打开飞行模式,然后再远一点,再次询问位置。

TL; TL; DR: It doesn't. DR:不是。 It returns the latest known location. 它返回最新的已知位置。

您可以在飞行模式下手动重新打开WiFi,如果等待足够长的时间,则可能会获得GPS修复,具体取决于iDevice型号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM