App killed by SIGKILL when changing privacy settings

余生长醉 提交于 2019-11-26 12:39:07

问题


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?


回答1:


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

  • https://devforums.apple.com/message/715855
  • https://devforums.apple.com/message/714178

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.




回答2:


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.




回答3:


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).




回答4:


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.




回答5:


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.




回答6:


OK my 1st time to write an answer. I hope I get it right :)

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.



来源:https://stackoverflow.com/questions/12652502/app-killed-by-sigkill-when-changing-privacy-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!