'Use also the option allow access to all photos in limited access dialog
I want to show the option to give access to all photos also in the limited photo library picker. I now go to the settings, but when returning to my app, it's kicks me out of the current screen. Is there an easy way to do this directly without leaving the app?
Thanks for your help!
func createAlertLimited(delegate: GalleryDisplayLogic?) -> UIAlertController {
let alertLimitedController = UIAlertController(
title: "Your app want to access your photos",
message: "The app needs access to your photos to allow using them.",
preferredStyle: .alert
)
// Select more photos
let selectPhotosAction = UIAlertAction(title: "Select more pictures", style: .default) { _ in
DispatchQueue.main.async {
let controller = self.getCurrentController()
PHPhotoLibrary.requestAuthorization() { result in
if #available(iOS 14, *) {
PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: controller ?? alertLimitedController)
} else {
// Fallback on earlier versions
}
}
}
}
// Select all photos
let selectAllPhotosAction = UIAlertAction(title: "Allow access to all photos", style: .default) { _ in
...
}
// Keep current selection
let keepSelectionAction = UIAlertAction(title: "Keep current selection", style: .cancel, handler: { _ in })
alertLimitedController.addAction(selectPhotosAction)
alertLimitedController.addAction(selectAllPhotosAction)
alertLimitedController.addAction(keepSelectionAction)
return alertLimitedController
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
