11

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?

Community
  • 1
  • 1
Cai
  • 441
  • 4
  • 15
  • 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. – Martin Kovachev Sep 21 '16 at 10:55

1 Answers1

2

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

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

Kyle Yi
  • 448
  • 4
  • 11