PHAsset identifier persisting across devices
Asked Answered
G

1

12

Following on from my previous question, and according to (among others) this question, the localIdentifier of a PHAsset doesn't persist across devices (after the photo syncs over iCloud).

How can I store a reference to a PHAsset (image) that will persist across devices?

Locally I store the localIdentifiers in an array so I can easily fetch the assets when needed, As the localIdentifiers dont persist across devices this obviously won't work. I don't want to store the actual image as this obviously has storage implications, and I wouldn't be able to use the Photos framework for things like easily loading thumbnails etc.

Is there any other way to get around this?

Galvan answered 8/1, 2016 at 22:17 Comment(1)
I have pretty much the same requirement. For the moment - as i don't see another existing way i will be taking a md5/sha1 hash of the image data and using this as an unique identifier - may be you can do something similar.Guardian
B
2

I knew it is quite old question, but Apple announced PHCloudIdentifier recently. It works great!

https://developer.apple.com/documentation/photokit/phcloudidentifier

Bracing answered 9/12, 2021 at 18:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.