Platforms to show: All Mac Windows Linux Cross-Platform

Back to PHPhotoLibraryMBS class.

PHPhotoLibraryMBS.authorizationStatus as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns information about your app’s authorization to access the user’s photo library.

Returns the current authorization status.

Accessing the photo library always requires explicit permission from the user. The first time your app uses PHAssetMBS, PHCollectionMBS, PHAssetCollectionMBS, or PHCollectionListMBS methods to fetch content from the library, or uses one of the methods listed in Applying Changes to the Photo Library to request changes to library content, Photos automatically and asynchronously prompts the user to request authorization.

Important
Your app’s Info.plist file must provide a value for the NSPhotoLibraryUsageDescription key that explains to the user why your app is requesting Photos access. Apps linked on or after iOS 10 will crash if this key is not present.

After the user grants permission, the system remembers the choice for future use in your app, but the user can change this choice at any time using the Settings app. If the user has denied your app photo library access, not yet responded to the permission prompt, or cannot grant access due to restrictions, any attempts to fetch photo library content will return empty PHFetchResultMBS objects, and any attempts to perform changes to the photo library will fail.

Tip
Use the DidChange event to observe photo library changes before fetching content. After the user grants access to the photo library for your app, Photos sends change messages for any empty fetch results you retrieved beforehand, notifying you that library content for those fetches is now available.

If this method returns PHAuthorizationStatusNotDetermined, you can call the requestAuthorization method to prompt the user for photo library access permission.

PHPhotoLibraryMBS.available as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Checks whether class is available.

Should return true on MacOS 10.13 or newer.

Errors

PHPhotoLibraryMBS.PHLocalIdentifierNotFound as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
One of the error constants.

The local identifier was not found.

PHPhotoLibraryMBS.PHPhotosErrorDomain as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The error domain for Photos errors.

PHPhotoLibraryMBS.requestAuthorization(CompletionHandler as RequestAuthorizationCompletedMBS, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Requests the user’s permission, if needed, to access the photo library.

CompletionHandler: Photos calls this delegate upon determining your app’s authorization to access the photo library.

Accessing the photo library always requires explicit permission from the user. The first time your app uses PHAssetMBS, PHCollectionMBS, PHAssetCollectionMBS, or PHCollectionListMBS methods to fetch content from the library, or uses one of the methods listed in Applying Changes to the Photo Library to request changes to library content, Photos automatically and asynchronously prompts the user to request authorization. Alternatively, you can call this method to prompt the user at a time of your choosing.

Important:
Your app’s Info.plist file must provide a value for the NSPhotoLibraryUsageDescription key that explains to the user why your app is requesting Photos access. Apps linked on or after iOS 10 will crash if this key is not present.

After the user grants permission, the system remembers the choice for future use in your app, but the user can change this choice at any time using the Settings app. If the user has denied your app photo library access, not yet responded to the permission prompt, or cannot grant access due to restrictions, any attempts to fetch photo library content will return empty PHFetchResultMBS objects, and any attempts to perform changes to the photo library will fail.

Use the DidChange event to observe photo library changes before fetching content. After the user grants access to the photo library for your app, Photos sends change messages for any empty fetch results you retrieved beforehand, notifying you that library content for those fetches is now available.

This method always returns immediately. If the user has previously granted or denied photo library access permission, it executes the delegate when called; otherwise, it displays an alert and executes the block only after the user has responded to the alert.

PHPhotoLibraryMBS.sharedPhotoLibrary as PHPhotoLibraryMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Retrieves the shared photo library object.

The singleton photo library object.

The items on this page are in the following plugins: MBS Mac64bit Plugin.


The biggest plugin in space...