Can CLLocationManager getCurrentLocation work without wifi or a cellular ne开发者_JAVA技巧twork? with the inbuilt GPS? Thanks.
For iPod Touch, yes. For iPhone, no.
iPod Touch doesn't have a built-in GPS receiver and it uses WiFi hot spot signatures for approximation.
The iPhone does have a built-in GPS receiver, so it works fine without 3G or WiFi.
Proof? Drive down the thruway and you'll go outside of 3G/Edge network, but Google Maps still tracks your current location.
I cannot find any documentation that confirms either yes or no, but from my experience I'd say yes. Core Location uses cell towers, wifi, and gps together to find your location so if one or two of the services are unavailable I would assume the system would use whatever resource it can. If it doesn't seem to work, it could be (I'm just guessing here) that you have to set the desired accuracy to something high (try kCLLocationAccuracyBest) in order for GPS to kick in.
If you haven't already, check out the video "What's new in Core Location" https://developer.apple.com/videos/wwdc/2011/index.php
if you want to get the gps go to maps, after turning the 3g and wifi off, and click the location icon on the bottom. then you will see loading and then it will give you the current location
精彩评论