File (NSURL) programmatically downloaded from iCloud -> Could not open() the item: [1: Operation not permitted]

Hi there,

i have an macOS app, sandboxed, compatibility 10.13 up to Sonoma, objective-C.

I have a dropzone (or alternatively selection with NSOpenPanel) where users can drop files which results in an array of NSURLs. I create bookmarks to securely access them. This worked for years.

Now i want to add iCloud support. Everything works good so far. I have methods to check the file status and download the file from icloud if NSURLUbiquitousItemDownloadingStatusKey == NSURLUbiquitousItemDownloadingStatusNotDownloaded

Then i listen for the file, once the status key changes to NSURLUbiquitousItemDownloadingStatusCurrent i continue with processing the NSURL and i want to create bookmarkData:

[filePathUrl bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope
                                    includingResourceValuesForKeys:nil
                                                     relativeToURL:nil
                                                             error:&error]];

But this returns the error "Could not open() the item: [1: Operation not permitted]" So i was wondering if downloading the file from iCloud now changed the NSURL itself so the given permissions by dropping do not match the downloaded file?

Adding [filePathUrl startAccessingSecurityScopedResource]; didn't change anything.

Any help appreciated

File (NSURL) programmatically downloaded from iCloud -> Could not open() the item: [1: Operation not permitted]
 
 
Q