How to reliably detect user-modified photos?

I'm developing a photo backup app.
To detect newly added or edited photos since the app launched, I keep a local dictionary in the format [localIdentifier: modification_date].

However, PHAsset.modificationDate is not reliable.
It often changes unexpectedly, possibly due to system operations like iCloud metadata updates.

Is there a more reliable way to detect whether a photo has been modified by user since the last app launch?

I'm thinking about using content hash instead, but I'm not sure how heavy this operation is in terms of performance.

Answered by DTS Engineer in 849584022

Using a content hash is probably the most reliable way to determine if an image file has been modified. Though, you're right, it is an expensive operation. Especially if you're trying to track a lot of photos. To avoid the overhead of decoding the image data, I expect you'd want to access the raw image data using the PHAssetResourceManager class.

Using a content hash is probably the most reliable way to determine if an image file has been modified. Though, you're right, it is an expensive operation. Especially if you're trying to track a lot of photos. To avoid the overhead of decoding the image data, I expect you'd want to access the raw image data using the PHAssetResourceManager class.

How to reliably detect user-modified photos?
 
 
Q