1

I have an app that uses the ALAssets framework to access to the users photo library. I wrote some code that detects whether or not the app has permission to access the photo library, and if it doesn't, I display an alert message which tells the user to turn on location services for the app in settings. Problem is, when I go into settings and turn location services on or off for my app, it crashes the app (it doesn't matter what view controller the app is on, even one where ALAssets isn't loaded,it still crashes).

Does anyone know why this is happening, and what I can do to fix this?

UPDATE: here is the crash report, on this line in main:

int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");

it says Thread 1: signal SIGKILL.

Ser Pounce
  • 14,196
  • 18
  • 84
  • 169
  • Where is the relevant code? Where is the crash report? We can't magically know what is going on. – Kerni Apr 10 '13 at 15:36
  • @kerni - I updated with some info about the crash. I'm not sure what code to post, as the crash is occurring when I make an adjustment to the settings from outside of the app (ie Settings -> Privacy -> Photos) – Ser Pounce Apr 10 '13 at 15:41

1 Answers1

4

Your app is being killed by iOS. This happens always privacy settings are changed that affect your app.

See: App killed by SIGKILL when changing privacy settings

In addition: requesting access to the Location services, will not grant you access to the photo library! That one is a separate privacy setting.

Community
  • 1
  • 1
Kerni
  • 15,241
  • 5
  • 36
  • 57
  • Thanks. I might post this is as another question, but I noticed another app that I use will restart itself when the user taps to open it if it detects that there has been a change to the settings. Do you know how to accomplish this? – Ser Pounce Apr 10 '13 at 15:46
  • You cannot let your app exit and restart again. There is only an exception for VOIP apps that can automatically be restarted if they crash. Instead of trying to restart your app, you should rather implement it that settings can be effective whenever they change without requiring a restart. Everything else is not user-friendly. Apples guidelines doesn't allow you to quit your app yourself anyway. – Kerni Apr 10 '13 at 16:00
  • For this particular problem, a lot of people have agreed this is the way that is best for the user. Tell them to change the privacy settings so the app will be able to access the photo library. Don't see any other way around that. BTW the app I mentioned is not a VoIP app, yet it seems to be able to detect the settings change and sort of reboot itself somehow. – Ser Pounce Apr 10 '13 at 16:05
  • NM someone helped me find the answer (http://stackoverflow.com/questions/15930708/having-app-restart-itself-when-it-detects-change-to-privacy-settings). Reason it was freezing / crashing is because I was running it from xCode. When I just run it off the phone, then I make a change to the settings, iOS reboots the app the next time it's open. Appreciate your help though. – Ser Pounce Apr 10 '13 at 16:11
  • That is exactly what I wrote and what the answers in the linked article say. The app gets killed by iOS. When running it with the Xcode debugger attached (which you didn't say previously) all that is different, is that the debugger intercepts the `SIGKILL` and showing your this information. So of course, the next time the app is opened, it restarts, since it was removed from memory before by the kill. That is the normal process on iOS. :) Oh, regarding the settings causing a restart: I was referring to app settings, not system settings which the privacy settings are. – Kerni Apr 10 '13 at 16:16