Extended file attributes stripped by iCloud sync

Hi!


I have two companion apps, iOS and macOS, supporting iCloud Drive to sync files between devices.


Both apps are operating on 3rd party file formats, which are - under certain conditions - enhanced with additional information. This metadata is currently saved in "extended file attributes" by using setxattr / getxattr .


Unfortunately I realized that the corresponding file attribute is stripped during iCloud synching. Changing the originally individual attribute name to "com.apple.ResourceFork" was unsuccessful, too. Some attribute seem to get synched, but I don't want to hijack attributes with other purposes, which will lead to unwanted side effects.


What is a supported way to store metadata with a 3rd party file format for iCloud syncing, when a file-wrapper is no option?


Greetings, Matthias

Answered by NateP in 633977022
I think the issue is that your extended attributes need to have the proper flags set on them to indicate they should be preserved when syncing (#S). There's more info here:

https:// eclecticlight.co/2019/07/23/how-to-save-file-metadata-in-icloud-and-new-info-on-extended-attributes/

(You need to remove the space after https://, because Apple doesn't allow links here for some reason).

I found the following statement in the „File System Programming Guide“:


Apps create files and directories in iCloud container directories in exactly the same way as they create local files and directories. And all the file’s attributes are saved, if they add extended attributes to a file, those attributes are copied to iCloud and to the user's other devices too.


Obviously that is not the case as I found my attribute as well as „com.apple.ResourceFork“ being stripped during iCloud synching to other devices. Other developers are observing the same behavior, here is a well-describing article about the problem:


https://eclecticlight.co/2018/01/29/icloud-drive-has-user-modes-and-tags-transferred-apps/


I've invested a DTS credit, but so far haven't received a response...

DTS asked me to file a bug report and my credit was refunded. Done: "Extended file attributes striped during iCloud Drive sync" (49108839).

This is just too sad: I filed the radar over two months ago, it still is in status „open“ with zip reaction from Apple. Unfortunately I have to take some serious decisions about the app‘s future development based on the chances / timeline to get this issue resolved. I asked for some response either via bug reporter and Developer Support ... but still no update.


I think I will file a new TSI just to get any update. Sorry, Apple, that‘s no way to support an active developer.

****, I hope they fix this soon, because I was also hoping of banking on this feature

Accepted Answer
I think the issue is that your extended attributes need to have the proper flags set on them to indicate they should be preserved when syncing (#S). There's more info here:

https:// eclecticlight.co/2019/07/23/how-to-save-file-metadata-in-icloud-and-new-info-on-extended-attributes/

(You need to remove the space after https://, because Apple doesn't allow links here for some reason).
@NateP: Wow, thank you so much for pointing me to the new article at electiclight ... I had abandoned my test using xattribs and was continuing using additional files ... with a lot of complications and limitations.

Looks like I will revive the deserted git branch, once I can spend some time on the corresponding project!

Thanks again, Mattes
Just to finally close this thread: Kudos to @NateP ... The last days I looked up my old git branch and integrated additional infos by extended file attributes using the required flag XATTRFLAGSYNCABLE (#S), and iCloud synching is working like a charm!

Thanks again, Mattes
Extended file attributes stripped by iCloud sync
 
 
Q