Cannot download photos from iCloud via Photos framework for some accounts

Originator:Mike.house.nsk
Number:rdar://FB7599120 Date Originated:02/25/2020
Status:Open Resolved:
Product:PhotoKit Product Version:iOS 13+
Classification:Incorrect/Unexpected Behavior Reproducible:Rear
 
All the time getting an error for some iCloud accounts when trying download photos from iCloud because the photos are not presented locally on a device. The error occurs for some iCloud photos:

Error Domain=CloudPhotoLibraryErrorDomain Code=25 "Failed to download CPLResourceTypeOriginal for ARUQNQfwZKmf/HcerGPjcRjjf1/H#PrimarySync (Record not found)" UserInfo={NSLocalizedDescription=Failed to download CPLResourceTypeOriginal for ARUQNQfwZKmf/HcerGPjcRjjf1/H#PrimarySync (Record not found)}

iOS Settings -> Photos has iCloud Photos enabled. Also in iCloud settings the iCloud is on for Photos app.

The code I use to export photos:

let options = PHImageRequestOptions()
options.version = .original
options.isSynchronous = false
options.isNetworkAccessAllowed = true
options.deliveryMode = .highQualityFormat
let id = PHImageManager.default().requestImageDataAndOrientation(for: asset, options: options) { data, _, _, info in { /*...*/ }

After I deleted some photos and added some new, seems the error has gone on my devices. But my clients (users) sometimes see this error and I cannot figure out what to suggest them to fix the error.

Comments

Apple

The local database could be out of sync with a delete that was pushed to cloud, and furthermore PhotoKit gives clients in-memory representations of assets, so those could become stale even more so. Trying to download a deleted stale asset, this sounds about right.

If the asset was actually deleted in the cloud this sounds like expected behavior.

The client should register for change notifications and respond to the asset deletion. Also the client app should not be persisting PHAssets over a long period of time as they may get stale.

Please confirm whether the asset was deleted earlier. If so this is expected.

By Mike.house.nsk at July 7, 2020, 3 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!