Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

walty

macrumors member
Original poster
Jul 15, 2008
33
0
Hi All,

Just got stuck with an issue of location service (CLLocationManager). Basically I only need the location at a specific instance of time, instead of a continuously updated location. So, I just called "startUpdatingLocation" and "stopUpdatingLocation" when I need to get the latest location.

And I found the code works fine when the event is triggered by button event. However, when I put the same code in viewDidLoad, so as to collect the location when system starts, it seems always return {0,0}. I once thought it may be because I touched agreement prompt too slow, so I tried to sleep 10 seconds after I called startUpdatingLocation, yet the location is still not collected. Is the location service could only be started when viewDidLoad is done? Yet the SDK documentation seems not mention the restriction as such.

Any advice please? Thanks.

have a nice day
walty
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.