How does CoreLocation locate the device?
More specifically, does CL require the user to have a data connection? Or is it possible to just use the phones service connectio开发者_StackOverflow社区n?
Thanks!
It actually uses several mechanisms.
- GPS
- Cell Tower Triangulation
- Wifi Hotspot cataloging
- Randomly assuming you are in Cupertino
There are tradeoffs based on speed, precision, and available hardware. A first Gen iPad will only have the 3 option available while the iPhone simulator makes use of the last mechanism.
You can observe the difference in these systems in the map application where it initially guesses based on the cell tower, then refines the guess via GPS.
Only options #3 requires a data connection.
And for the humor impaired including #4 was not totally serious although it is functionally correct. (I think they simulate the GPS reporting that location rather than just hard coding it, but I haven't checked.)
You can set the phone into airplane mode and still get a location :)
It will be forced to use GPS to get it so it might take longer to get though.
精彩评论