App killed by SIGKILL when changing privacy settings
Asked Answered
C

7

53

My iOS app accesses the user's Photos with ALAssetsLibrary. When I change the privacy settings for the app (Settings → Privacy → Photos), the app gets killed by system (SIGKILL). Is this a bug?

Cobaltite answered 29/9, 2012 at 11:55 Comment(11)
Uh-oh... I have test with Apple's MyImagePicker and get the same crash.Cobaltite
is it crashing or just restarting? I have also seen this behavior but looks to be our of our control.Touchy
Good report, good testing. I've elaborated a little in my answer regarding UIImagePickerController; it's clearly the same bug. Thanks for posting about this.Laritalariviere
Seeing the same thing here with the Calendar privacy settings.Gratulant
As of iOS7, at least, when running the app on the device proper (NOT in Xcode device debugging or simulator), the app will be automatically restarted. If you handle the restart fine, the user will never know the app "crashed".Woolworth
Greetings from the future! Still happening in iOS 9. I've added a little "the app may need to restart" warning before directing the user to settings.Kuntz
Still happening in iOS10 but seems to be expected behaviour. When app permissions are changed, iOS restarts the app in background.Uxmal
Still happens on IOS11 (at least in simulator). App exits when privacy settings are toggled. Judging by the info here It seems this is intended behaviour and won't change anytime soonGorges
Allow me to add that it still happening on iOS 12 :'(Altorelievo
Happens for bluetooth as well. Suprisingly doesn't happen for access to locationElaterite
I'm just going to jump on the bandwagon and add it also still happens in iOS 14.Bundesrat
R
40

I think it is a bug or at least poorly documented and unexpected behavior. But it does not crash it is just forced to restart. You will get a SIGKILL message but no Crash log.

If you are a registered apple developer you can check their forums for discussions about this issue. Here's one.

I don't know of any way how to prevent this behavior but feel free to file a bug report with apple. It is rumored they use bug duplicates as a way of measuring the bug severity. Maybe you can store your app state in order to restore it when it restarts.

Repair answered 17/10, 2012 at 16:11 Comment(5)
I have become more and more gloomy about this situation. I have not yet received any reply from Apple but I'm pretty sure that Apple thinks this is NOT a bug. I think their feeling is: the privacy situation has changed, so your app probably needs to begin all over again. The trouble is that they have decided badly. After all, they don't crash your iCloud app when the user switches on iCloud, the don't crash your WiFi app when the user switches on WiFi, so why crash your photo app when the user switches on photos? They should just send me a notification of some sort and let me handle it.Laritalariviere
it makes more sense if the permission is taken away from iOS settings for a app ( assuming app running in bg already has access to , say , photos) iOS is simply killing the app that may already have access to data.Southbound
Thanks, Is there any apple official documentation link?Smithery
This also happens for Camera and Microphone settings. I opened a feedback report asking to at least update documentation with reasoning about it. FB9585153Sheridan
Documented in WWDC 2012 session 710 Video: download.developer.apple.com/videos/wwdc_2012__hd/… The slides of this presentation are here docs.huihoo.com/apple/wwdc/2012/…Shakira
L
11

This happens as well when using UIImagePickerController. The sequence goes like this:

  1. You show the UIImagePickerController. The first time, the little alert asks the user for permission to use the photo library. Let's say the user says no.

  2. All the user can do with the picker controller at this point is cancel, so let's presume that's what happens.

  3. On some later occasion, you show the UIImagePickerController. It now contains a noncustomizable message saying that there is no access to the photo library, but that the user can enable access in Settings.

  4. The user switches to Settings and enables access to the photo library for this app.

  5. The app crashes in the background. It doesn't matter whether the user has cancelled the picker or left it showing.

I've filed a bug on this and I suggest you do the same, for your situation. Apple introduced a new privacy system in iOS 6 and clearly the kinks have not been worked out.

Laritalariviere answered 1/12, 2012 at 17:50 Comment(1)
Fortunately, this situation will not be too frequent. :)Cobaltite
T
9

Search for the word "kill" within this PDF: http://adcdownload.apple.com/wwdc_2012/wwdc_2012_session_pdfs/session_710__privacy_support_in_ios_and_os_x.pdf

iOS kills apps when certain permissions change.

This info is hard to track down. It's not in any of the 'guides' (preferences programming guide, for example).

Tore answered 23/11, 2015 at 17:47 Comment(3)
It's explained in the session video starting at about 11m22s.Manservant
Here is the updated link: download.developer.apple.com/wwdc_2012/wwdc_2012_session_pdfs/…Pilar
The slides of this presentation are here docs.huihoo.com/apple/wwdc/2012/…Shakira
R
3

When you test your app using simulator.Changing the permissions of the app gives you a breakpoint.You can type "c" in the console to make the app continue to run and goes back to the original state.But in your real device,that is not the story.It just reboot the app.

Revenant answered 30/11, 2015 at 3:25 Comment(0)
D
2

Some times SIGKILL error work as a interruption error, it gives signal to iOS that you have to restart your app and on the same time we are managing app tasks and on that instance the way of sending interruption message is not handled by app.

In my case..... I don't allow the photos and camera access in the app and whenever I am allowing to access these features, I minimize the app and enables these settings. As I enabled these, iOS get an interruption and app receives this but can't handle and result our app terminates or closed.

Ditheism answered 14/11, 2015 at 10:1 Comment(5)
How to handle if i don't want to restart my appVeinule
You need to allow all that cases, resulting your app not need to restart...Ditheism
Can u give me an example? How to do that ?Veinule
Not example, you can check in your code also....you can follow the above points...Ditheism
Let us say user is deep inside the app (I mean he is in a viewcontroller which is not a dashboard). So after he is changed the permission he will landed to dashboard instead of his previous controllerVeinule
I
0

Are you accessing the Asset Library using the assetForURL:resultBlock:failureBlock:?

If you are then, most likely you are not handling the failure block of the ALAssetLibrary.

You could do something like

ALAssetsLibraryAccessFailureBlock failureBlock = ^(NSError *error)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Access to Photo Library is Denied "
                                                            message:@"Please allow <YOUR APP NAME> to access your Photo library from Privacy Settings"
                                                           delegate:nil
                                                  cancelButtonTitle:@"OK"
                                                  otherButtonTitles:nil];
            [alert show];
            [alert release];
}

So when your app doesn't have access to the photo library it will ask the user to do it.

Intercellular answered 14/10, 2012 at 14:26 Comment(3)
Congratulation! and thank you :-) But this is not the answer I wanted.Cobaltite
A permission denial has to be handled anyway. The problem here is that AFTER the user gets the denial message, they leave the app open and go to settings to turn on access. When they RETURN to the app, then, the app crashes! Not a good user experience...Woolworth
Update to my own comment: actually, in the simulator, the app "crashes" with the SIGKILL. On the device, iOS immediately restarts the app, so the user has no idea the app abruptly ended - as long as the restart is handled correctly within the app.Woolworth
P
-1

I am not sure how much this would help, but I am experiencing a similar issue where the app crashes when I turn off/on Bluetooth via the privacy settings (Settings → Privacy → Bluetooth), but it doesn't crash when I change the Bluetooth settings directly (Settings → Bluetooth), so I think two things could be said here.

  1. This isn't a bug specific to the app you are using, and is a more generic issue.
  2. Going through the privacy settings may be where the cause is.

I am also looking for a solution on how to prevent it though, so just sharing an insight on where the cause may be for now, but hopefully it can be solved! Thanks!

Padget answered 9/5, 2023 at 7:39 Comment(1)
If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From ReviewKelby

© 2022 - 2024 — McMap. All rights reserved.