We are trying to create a new photo album using PHPhotoLibrary perform changes with completion handler method:
__block PHObjectPlaceholder* theAlbumPlaceholder;
[ theLibrary performChanges: ^
{
NSString* theAlbumName = [ self getAlbumName ];
PHAssetCollectionChangeRequest* theRequest = [ PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle: theAlbumName ];
theAlbumPlaceholder = theRequest.placeholderForCreatedAssetCollection;
} completionHandler ...
Inside the completion handler, "success" is YES and theAlbumPlaceholder.localIdentifier is not nil. We then call [ PHAssetCollection fetchAssetCollectionsWithLocalIdentifiers: @[ theAlbumPlaceholder.localIdentifier ] options: nil ] but it returns 0 results. How is this possible? It only ever happens in the wild to users, our data shows it only happens on iOS 12. We cannot seem to reproduce in house.
Any ideas why the perform changes would say success YES, but then be unable to find the album you created using the identifier of the placeholder?