0

I'm created an app in order to unzip files from iCloud drive and extract their content on iCloud drive too. For the moment I can select the file I want to unzip thanks to UIDocumentPickerViewController. Once the file is selected, the delegate "documentPicker" is fired.

Here is the code of this method :

func documentPicker(controller: UIDocumentPickerViewController, didPickDocumentAtURL url: NSURL){
    let fileManager: NSFileManager = NSFileManager.defaultManager()

    if let iCloudDocumentsURL = NSFileManager.defaultManager().URLForUbiquityContainerIdentifier(nil)?.URLByAppendingPathComponent("Documents") {
        if (!fileManager.fileExistsAtPath(iCloudDocumentsURL.path!, isDirectory: nil)) {
            do{
                try fileManager.createDirectoryAtURL(iCloudDocumentsURL, withIntermediateDirectories: true, attributes: nil)
            }catch{
                print(error)
            }
        }

        SSZipArchive.unzipFileAtPath(url.path, toDestination: iCloudDocumentsURL.path, delegate: self)
    }
}

For the moment this method unzip the file I selected on the picker and put his content to iCloud "Documents" folder. I can see my files on Settings -> iCloud -> Manage -> MyApp. But my goal is to not put files on this folder but to put them on iCloud drive.

Anybody knows how to do that ?

For information this is my Info.plist section :

<key>NSUbiquitousContainers</key>
<dict>
    <key>iCloud.com.fabien.UnzipFile</key>
    <dict>
        <key>NSUbiquitousContainerIsDocumentScopePublic</key>
        <true/>
        <key>NSUbiquitousContainerSupportedFolderLevels</key>
        <string>Any</string>
        <key>NSUbiquitousContainerName</key>
        <string>Privacy</string>
    </dict>
</dict>

Thanks for your help !

Edit

I found the solution. For information I just changed the version of my application in order to resolve my problem. I think the fact to change the version re-scan the Info.plist file.

  • You are writing the files to iCloud Drive. – rmaddy May 16 '16 at 15:00
  • Yes but I would like to be able to see them on the iCloud Drive app. For the moment I only see my files on Settings -> iCloud -> MyApp but not on the application. I tried to kill the app and relaunch it without success. – Fabien Ducret May 16 '16 at 16:37

0 Answers0