开发者

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

开发者 https://www.devze.com 2023-04-03 20:49 出处:网络
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.

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.

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 lo开发者_运维知识库cation 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.

You can try this by getting your location, turn Airplane mode on and then go far from there, ask the location again.

TL; DR: It doesn't. It returns the latest known location.


You can manually turn WiFi back on in Airplane Mode, and possibly get a GPS fix if you wait long enough, depending on the iDevice model.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号