I'm trying to write a file into ubiquitous folder, I can run a query and all works fine, I see the files, but If I try to set a local file I obtain this error:
Error Domain=NSCocoaErrorDomain Code=513 "“video.mp4” couldn’t be moved because you don’t have permission to access “DemoExample”." UserInfo={NSSourceFilePathErrorKey=/var/containers/Bundle/Application/3C3DC6B5-7B22-4B1C-B8AB-187F640F68AB/DemoExample.app/video.mp4, NSUserStringVariant=(
Move
), NSDestinationFilePath=/private/var/mobile/Library/Mobile Documents/iCloud~com~Test~DemoExample/Documents/video.mp4, NSFilePath=/var/containers/Bundle/Application/3C3DC6B5-7B22-4B1C-B8AB-187F640F68AB/DemoExample.app/video.mp4, NSUnderlyingError=0x17405c5c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
Video.mp4 exists in folder, what wrong?
here is the code for save file:
try self.fileManager.setUbiquitous(true, itemAt: URL.init(fileURLWithPath:file.path), destinationURL: iCloudUrl)
I use this:
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.com.Test.DemoExample</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>backup</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
Please follow the below steps one by one. Hope it will solve your problem....