If I deny at first, then go to settings and allow in settings, in both cases the status is notDetermined, instead of denied then authorized. Why is that happening?
It doesn't save the image when i click "Don't allow", but status becomes .notDetermined not .denied .
It saves, after i go to settings->Photos, uncheck "Never" and check "Add Photos Only". But the status stays .notDetermined, does not become .authorized
func save(){
guard let image = imageView.image else {return}
UIImageWriteToSavedPhotosAlbum(image, self, nil, nil)
let status = PHPhotoLibrary.authorizationStatus()
switch status {
case .authorized:
print("authorized")
return
case .notDetermined:
print("not determined")
case .denied, .restricted:
print("denied or restricted")
//please go to settings and allow access
promptToSettings()
}
}
I am asking permission to save an image to photo library. When the first time the user tries to save, he gets asked: "App would like to add to Photos" "Don't Allow" "Ok" If the user denied then tried to save again,i want to check and if the status is .denied, prompt the user to go to settings and allow. But the code goes to .notDetermined block when the user does not give access the first time. It stays .notDetermined even after in settings the user allows access.