Class

PHPhotoLibrary

A shared object that manages access and changes to the user’s shared photo library.

Declaration

@interface PHPhotoLibrary : NSObject

Overview

The shared PHPhotoLibrary object represents the entire set of assets and collections managed by the Photos app, including both assets stored on the local device and (if enabled) those stored in iCloud Photos. You use this object for the following tasks:

  • Getting or verifying the user's permission for your app to access Photos content.

  • Making changes to assets and collections; for example, editing asset metadata or content, inserting new assets, or rearranging the members of a collection.

  • Registering for update messages sent when changes are made to the library.

Topics

Verifying Authorization

+ authorizationStatus

Returns information about your app’s authorization to access the user’s photo library.

+ requestAuthorization:

Requests the user’s permission, if needed, to access the photo library.

PHAuthorizationStatus

Information about your app’s authorization to access the user’s photo library, used by the authorizationStatus and requestAuthorization: methods.

Getting the Shared Photo Library Object

+ sharedPhotoLibrary

Retrieves the shared photo library object.

Applying Changes to the Photo Library

Requesting Changes to the Photo Library

Create, delete, or modify assets and collections in a photo library by making change requests.

- performChanges:completionHandler:

Asynchronously runs a block that requests changes to be performed in the photo library.

- performChangesAndWait:error:

Synchronously runs a block that requests changes to be performed in the photo library.

PHAssetChangeRequest

A request to create, delete, change metadata for, or edit the content of a Photos asset, for use in a photo library change block.

PHAssetCollectionChangeRequest

A request to create, delete, or modify a Photos asset collection, for use in a photo library change block.

PHCollectionListChangeRequest

A request to create, delete, or modify a Photos collection list, for use in a photo library change block.

PHObjectPlaceholder

A read-only proxy representing a Photos asset or collection object yet to be created by a change request.

Observing Changes to the Photo Library

Observing Changes in the Photo Library

Register an observer to be notified of changes to the photo library.

- registerChangeObserver:

Registers an object to receive messages when objects in the photo library change.

- unregisterChangeObserver:

Unregisters an object so that it no longer receives change messages.

PHPhotoLibraryChangeObserver

A protocol you can implement to be notified of changes that occur in the photo library.

PHChange

A description of a change that occurred in the photo library.

PHObjectChangeDetails

A description of changes that occurred in an asset or collection object.

PHFetchResultChangeDetails

A description of changes that occurred in the set of asset or collection objects listed in a fetch result.

Instance Properties

Relationships

Inherits From

See Also

Shared Photo Library

Browsing and Modifying Photo Albums

Help users organize their photos into albums and browse photo collections in a grid-based layout using PhotoKit.

Requesting Authorization to Access Photos

Prepare your app to ask for permission when accessing the user's photo library.