1

I am seeing an issue with Location Services still being used by my app even if the app has been killed from the multitasking bar. If I go into Settings > Privacy > Location Services I notice that my app has a purple location icon even while there are NO apps in the background. If I turn off Location Services for my app, the icon in the status bar disappears.

I have ensured in my app that I am stopping location services when they are not needed. I have verified this numerous times in Instruments. GPS turns on when it is supposed to and when the task is finished using location services, the GPS is turned off.

In my applicationWillTerminate: delegate, I even set the lcoationManager to nil, set the delegate to nil and make sure all of that is cleaned up. I still see the icon in the statusbar when I KILL my app.

This particular app also has a bluetooth accessory that can make the app do certain things. So for instance, I press a button on my BLE accessory and it makes the app do something which will trigger a UILocalNotification, so I see a banner. I don't know how to reproduce this particular issue, but I've noticed that even if there are NO apps in the multitask bar and I press the button on my BLE accessory, it will trigger the action in the app and I will see the notification banner.

A few questions:

  1. Has anyone else seen anything like this?
  2. How can I ensure that my app is COMPLETELY killed even though I have cleaned up really good on application terminated?
  3. Why would the location services still be running even though the app is killed. Also keeping in mind that I do NOT use any region monitoring or significant location update changes.

Update:

So I took a previous version of the app and reset Location & Privacy settings and to my surprise, backgrounding the app makes the location icon disappear (as it should have been doing all along. To me this means that iOS is keeping some residual information or settings from the app? Anyone have any insight as to what could be going on here?

Update 2:

Still occurs in iOS 8.1.x.

WrightsCS
  • 50,551
  • 22
  • 134
  • 186
  • "In my applicationWillTerminate: delegate, I even set the lcoationManager to nil" - well, that's probably bogus, because your app delegate will likely *never* get `applicationWillTerminate:`. – matt Apr 26 '13 at 00:56
  • It does in fact because I have an NSLog that prints out each time it's hit. – WrightsCS Apr 26 '13 at 01:06
  • Well, then your app must be running in the background. And isn't that exactly what you just said it should not be doing? – matt Apr 26 '13 at 01:08
  • If you read my question, I stated that I KILL the app from the MULTITASKING bar. So in theory, all traces of the app should be released from memory. It's still a wonder why prior to resetting Location Services, the icon would persist with **0** apps in the multitasking bar. – WrightsCS Apr 26 '13 at 01:16
  • Well, you're making a lot of assumptions here, and I don't know if they are all true. How do we know the icons are not just a lag? I've seen this same sort of thing with the Maps app, for example. Or, contrariwise, how do we know whether killing the app really kills the background task? – matt Apr 26 '13 at 01:20
  • Right, the background task - that is a good question and perhaps a bug in iOS in my opinion. And as far as "lag"? The icon persists for days at a time, where as it should typically take (as it does now after resetting location services) 10 seconds to disappear. As for Maps, I'm sure Apple uses `setShowUsersLocation:YES` which could possibly be another reason along with region monitoring and significant location changes (none of which I use). – WrightsCS Apr 26 '13 at 01:27
  • One important thing... since I came across the same issue. Killing the app from the multitasking bar does NOT end the location service! From the apple documentation: – Franz van der Steg May 02 '13 at 09:56
  • Sorry... once again: One important thing... since I came across the same issue. Killing the app from the multitasking bar does NOT end the location service! From the apple documentation: "(...)it does tell the system that it should wake up the app whenever there is new location data to deliver(...)". So it wakes the app up even if the app is suspended! So I assume although you wrote you stoped the location services that you did not... that was my error when I had the same issue. I think you do not need to nil the CLLocationManager. – Franz van der Steg May 02 '13 at 10:05

0 Answers0