Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ALAssetRepresentation URL 'persistence' lifetime?

Quick question: for how long is an ALAssetRepresentation URL (its 'url' property) guaranteed to point to the same asset?

The documentation describes it as 'persistent' but does this mean persistent over a single sync, persistent until new photos are added, persistent until old photos are deleted, or what? If I build a database that associates photo elements in the Camera Roll/Photo Library to data in my application using their ALAssetRepresentation url's, will these associations continue to work forever, even if the photos are moved or renamed?

like image 216
damian Avatar asked Nov 14 '22 05:11

damian


1 Answers

From my observations, if you delete photos/videos from the camera roll, say 1000000007, assuming the current last id is 1000000008, the next saved item will not reuse the identifier, but will rather be 1000000009. However, if the last image is deleted (1000000008) it will reuse that one.

Basically it picks the highest unused identifier number, but if you delete items using less than the current highest identifier, it will not "fill-in" old identifiers.

This is only with photos in the camera roll. I'm not sure about the other ALAssetGroups.

like image 93
chilitechno.com Avatar answered Dec 10 '22 06:12

chilitechno.com