Issue
More specifically, how can you know whether a PHAsset
has current version of the underlying asset different than the original?
My user should only need to choose between the current or original asset when necessary. And then I need their answer for PHImageRequestOptions.version
.
Solution
I have found a way to determine whether a PHAsset
has been edited or not. Using a PHAssetResource
API, you can get an array of data resources for a given asset. If the photo has been modified, it will have at least one resource that is the adjustment data of an edit.
let isEdited = PHAssetResource.assetResources(for: asset).contains(where: { $0.type == .adjustmentData })
Note that if you want to actually work with a resource file, you have to fetch its data using a PHAssetResourceManager
API. Also note that this method returns right away - there's no waiting for an async network request, unlike other answers here.
Answered By - Jordan H Answer Checked By - Marilyn (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.