App killed by SIGKILL when changing privacy settings

后端 未结 6 1997
别跟我提以往
别跟我提以往 2020-11-29 23:01

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 b

6条回答
  •  执念已碎
    2020-11-29 23:31

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

提交回复
热议问题