Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GPS app stopped working on iOS 5 - Location Manager not updating

I have developed an app targeted for iOS 4.3. It worked fine. But since I migrated to iOS 5.0, the app has started showing strange behavior. The location manager is not showing updates on change in position. Has anyone encountered this kind of problem?

Thanks for any help.

like image 926
Jigar Tank Avatar asked Dec 05 '25 14:12

Jigar Tank


2 Answers

I had my fare share with CLLocation manager weird updating issues when moving from iOS 4.x to 5:

  1. Have you subclassed the CLLocationManager object ?

    • problem : In that case sometime the delegate methods sometime don't get called (ex. didUpdateLocation).

    • fix: don't subclass CLLocationManager

  2. Is the CLLocationManager instanced from a Singleton ?
    • problem: using the CLLocationManager object as a property of a singleton object worked fine in 4.x but was inconsistent in iOS5
    • fix:move the object to a non-singleton object
  3. If either of the above helps , or you've tried it and it failed
    • problem: for some reason the CLLocationManager still doesn't run from the main thread and so you experience the strange behavior.
    • fix#1: create the CLLocationManager object as a property in the appDelegate without subclassing it . (this solution proved to work best , even on jailbroken iphones) . you can still use a dynamic property pointing to it's instance from the singleton if you design is similar to case 2.
    • fix#2: a more dirty solution is making sure it runs from the main runloop either using performSelectorOnMainThread or some other way

Hope this helps :)

like image 187
Tamir Avatar answered Dec 07 '25 05:12

Tamir


The way iOS 5 handles memory management could be one way. If you are declaring a variable in your .h file and not referencing it correctly or implicitly [self.myVar doSomething]; it could be dumping out on you without you knowing it. It will still compile fine, but will mainly be ignored and passed over.

Not 100% without seeing code, but I have noticed this issue as well with some of our company's older programs when iOS 5 came calling. Good luck.

like image 29
Bill Burgess Avatar answered Dec 07 '25 05:12

Bill Burgess