Instance Method

performChanges:completionHandler:

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

Declaration

- (void)performChanges:(dispatch_block_t)changeBlock completionHandler:(void (^)(BOOL success, NSError *error))completionHandler;

Parameters

changeBlock

A block that requests changes to be performed.

This block takes no parameters and has no return value.

completionHandler

A block that Photos calls after the change block completes and Photos performs the requested changes.

The block takes the following parameters:

success

YES if Photos successfully applied the changes requested in the block; otherwise, NO.

error

If an error occurs, an NSError object describing the error; otherwise, nil.

Discussion

Photos executes both the change block and the completion handler block on an arbitrary serial queue. To update your app’s UI as a result of a change, dispatch that work to the main queue.

See Also

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.

- 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.