0

I'm making a background tracking GPS app for iOS 7.0+.

I'm having issues when tracking position while in background, it's killed after exactly 5 minutes, even if we are in the middle of a highway, with 1 location per second. It's not killed when constantly in active state.

This seems to occur only on iOS 7.0 version, not on later versions.

I already registered the plist location background activity.

I need maximum accuracy and shortest update time, so I'm not using the significant change method but the basic startUpdatingLocation. This application is used mainly plugged inside a car (no mercy for battery).

I set the location delegate to the app delegate so it's less subject to be deallocated.

Even with all of this done, it's still impossible to take this app alive in background more than 5 minutes.

I'm fighting on iOS which always find a way to terminate my app, even with app state restoration.

So the question is, is there a way to know why my application is killed ?

List of threads that didn't help me or does not respond to my needs, and that I already visited :

Community
  • 1
  • 1
Crazyrems
  • 2,551
  • 22
  • 40
  • Do you activle use the location while in background? (E.g buffer it, and write it to file system), or do you only use the location to display something on a map (not visisble because in background) – AlexWien Jun 24 '14 at 17:37
  • Is your app being terminated or is it crashing? – onnoweb Jun 24 '14 at 19:15
  • It is actually terminated since I do not have crash reports (HockeyApp). I don't write in any buffer or system file while in background, just inserting positions in an array. I should use deferred locations, but since it may run on devices that doesn't enable deferred locations, I didn't have optimized the code yet. – Crazyrems Jun 25 '14 at 08:04

1 Answers1

0

The system will not tell you why the app was terminated.

I set the location delegate to the app delegate so it's less subject to be deallocated.

The delegate has no effect on whether the location manager is deallocated or not. You must keep a strong reference to the location manager itself.

Austin
  • 5,625
  • 1
  • 29
  • 43
  • Thanks for the answer. I thought it was the delegate that was deallocated, not the location manager itself. I need to make a strong reference to the location manager since it's in a singleton, and I'm not sure that class variables are strong by default. – Crazyrems Jun 25 '14 at 07:59