UIDocument Renaming with UIDocumentBrowser

I am using the "new way" of storing documents (iOS 11+) using UIDocumentBrowserViewController. No need for iCloud API, Entitlements etc. -- just works (under control of the separate Document Browser process).

However, I haven't figured out how to rename (i.e. move) a document programmatically this way, at least within iCloud. The standard "url.setResourceValues()" does work just fine on the local filesystem, but renders in 513/not permitted in iCloud. Also all the former ways of doing it (using full set of iCloud capabilities & entitlements, using complex FileCoordinator orchestration etc.) don't work either when the created document actually is controlled through the document browser.

I couldn't find any reasonable documentation or example on how to use the UIDocumentBrowser to also move a document under it's (and somewhat my) control. There is the UIDocumentBrowserImportModeMove mode that might do what I need, however I have no clue how to programmatically initiate that on a given UIDocument.

Has anyone already made experiences to do it this way?

Thanks, habitoti

I'm also getting thhe "You don't have permission to save ..." when I try to "rename" a document within my apps iCloud folder. I'm using the


document.save(to: newFileURL, for: .forOverwriting) { ...


dance which works fine as long as I'm in the local app's Documents folder.


Any hints how to solve that issue for the apps iCloud folder?

UIDocument Renaming with UIDocumentBrowser
 
 
Q