Are there ever circumstances where the localIdentifier could change or not be accurate? I'm working on an application that backs up photos and have been told by my colleagues that the localIdentifier can't be trusted. However, after doing some research I have been unable to find anyone talking about this.
LocalIdentifiers sometimes change after updating the iOS version.
I've seen the PHAsset.localIdentifiers
(Photo API) change after iOS updates twice - in my own Apps. The last time was after updating to iOS 11. The app in question kept track of localIdentifiers so specific images could be found/sorted according to various predicates.
As soon as the update from iOS10 to 11 finished, all the localIdentifiers saved locally by the app became useless as they didn't match any device images, although they still existed in the camera roll.
Like you I've searched for info on this subject without success. Sorry that my reply is bad news.
Use PHCloudIdentifier everywhere. You can use myCloudIdentifier.stringValue if you need it for data storage purposes.
Use cloudIdentifiers(forLocalIdentifiers:) method to convert from local to cloud and the sister method, localIdentifiers(for: [PHCloudIdentifier]), to convert back again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With