Как показать значок в папке «Файлы»? - PullRequest
0 голосов
/ 05 марта 2020

Я внедряю ICloud в своем новом приложении, и я хотел бы иметь папку в приложении «Файлы». Код для создания каталога:

func createDirectory(){
    if isICloudContainerAvailable() {
        if let iCloudDocumentsURL = FileManager.default.url(forUbiquityContainerIdentifier: nil)?.appendingPathComponent("Documents") {
            print(iCloudDocumentsURL.path)
            if (!FileManager.default.fileExists(atPath: iCloudDocumentsURL.path, isDirectory: nil)) {
                do {
                    try FileManager.default.createDirectory(at: iCloudDocumentsURL, withIntermediateDirectories: true, attributes: nil)
                }
                catch {
                    //Error handling
                    print("Error in creating doc")
                }
            }
        }
    }
    else {
        self.present(UIAlertController.init(title: "Oops!", message: "Not logged into iCloud", preferredStyle: .alert), animated: true, completion: nil)

    }
}

И в Info.plist я добавил

<key>NSUbiquitousContainers</key>
<dict>
   <key>iCloud.MyNewApp.com.MyNewApp</key>
   <dict>
     <key>NSUbiquitousContainerIsDocumentScopePublic</key>
     <true/>
     <key>NSUbiquitousContainerName</key>
     <string>MyNewApp</string>
     <key>NSUbiquitousContainerSupportedFolderLevels</key>
     <string>One</string>
  </dict>
</dict>

Но я получил это

enter image description here

И я бы хотел получить это.

enter image description here

Какие-либо советы по созданию sh папки в приложении Files? Спасибо.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...