My application tracks the user using the CLLocationManager . In the didUpdateToLocation delegate didUpdateToLocation I do the most interesting thing to maintain my position. However, I needed a way to check if they had stopped. This far I could stop recording places and consider their trip. Therefore, I have NSTimer in CCLocationManager , which is added and removed each time didUpdateToLocation called. This will happen when the user stops and the CLLocationManager stops receiving the call.
The only way I could get NSTimer to work:
[[NSRunLoop mainRunLoop] addTimer:userStoppedMovingTimer forMode:NSRunLoopCommonModes];
Then, to remove it:
[userStoppedMovingTimer invalidate]
I have never had to add such timers in the past. Can someone shed some light on why this is so?
source share