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 :(")
}
}
}