'UbiquityContainer: Tracking deleted files vs renamed files
My app tracks files (PDF, text...) in an iCloud Ubiquity Container. The user through my app can add properties to each file (Notes, tags...). Those properties are maintained in a per device db and I use the file url to track the file. Everything works fine. I get notified correctly when files are deleted or added etc... Not problem there.
Only issue is when a file is renamed. If my app is running I get a notification that a file url changed but I have no idea which file was renamed (I don't get the old url). If a rename happens while my app is not running, then on launch, during the gathering phase, it looks like a file was deleted and a new file was created. Again I have no idea that it was a rename.
The only solution I found so far (which I don't really like) is to add an extended attribute containing an uniqueID to each file I track. During the gathering phase I can check the url and the uniqueID (if there is one) to figure out which file was gathered.
This solution is very fragile and I was wondering if someone has figured out something better.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
