0

I've read this almost duplicate question: App crashes on enabling Camera Access from Settings iOS 8 , but my issue isn't solved there.

After initially denying permission for photo library access, I deep link to settings. After enabling access to photos, the app crashes with SIGKILL, which is expected according to Apple specs.

Upon returning to app via back button in status bar one of two things happens depending on whether it's simulator or device:

Simulator: PHAuthorizationStatus does not reflect new status Device: App is frozen

How can I fix this?

P.S. The code is as follows

if (UIImagePickerController.isSourceTypeAvailable(.PhotoLibrary)) {

                if (UIImagePickerController.isSourceTypeAvailable(.PhotoLibrary)) {
                    let status = PHPhotoLibrary.authorizationStatus()
                    if (status == .Authorized) {
                        self.launchGalleryPicker()
                    } else if (status == .NotDetermined) {
                        PHPhotoLibrary.requestAuthorization {
                            (authStatus) in
                            if (authStatus == .Authorized) {
                                self.launchGalleryPicker()
                            }
                        }
                    } else {
                        print("Doesn't work :(")
                    }
                }
            }
Community
  • 1
  • 1
cph2117
  • 2,651
  • 1
  • 28
  • 41
  • Click the "stop" icon in the debugger before returning to your app. It's the debugger that is freezing the app. – rmaddy Oct 16 '15 at 23:33
  • 1
    @rmaddy it still seems to have the incorrect authorization state though... – cph2117 Oct 17 '15 at 23:18

1 Answers1

0

Where is your code? Put it in viewDidLoad so that when you come back to the app from the back button in the status bar, your view with load and will check the authorization status again.