requestAuthorization(for:handler:)
requestAuthorization(for:handler:)
requestAuthorization(for:handler:) Type Method of PHPhotoLibrary Prompts the user to grant the app permission to access the photo library.
class func requestAuthorization(for accessLevel: PHAccessLevel, handler: @escaping @Sendable (PHAuthorizationStatus) -> Void)Parameters
accessLevel
The access level to request.
handler
The callback the system invokes when it’s made a determination of the app’s status.
Discussion
For more information about accessing the user’s Photos library, see //com.apple.photokit/documentation/PhotoKit/delivering an enhanced privacy experience in your photos app.