0
我會讓用戶使用iCloud驅動器保存其數據的備份。這很好。但是,如果我切換到其他啓用iCloud Drive的設備,我無法讀取該文件。保存在iCloud Drive上的文檔似乎不能在iOS上下載
我能看到的iCloud雲端硬盤應用中的備份文件,但它不是下載的,(它顯示了icloud的符號「下載)。
是否可以強制目錄中提供下載的所有文件如果用戶想恢復備份?
iOS上使用8/9斯威夫特2。
我會讓用戶使用iCloud驅動器保存其數據的備份。這很好。但是,如果我切換到其他啓用iCloud Drive的設備,我無法讀取該文件。保存在iCloud Drive上的文檔似乎不能在iOS上下載
我能看到的iCloud雲端硬盤應用中的備份文件,但它不是下載的,(它顯示了icloud的符號「下載)。
是否可以強制目錄中提供下載的所有文件如果用戶想恢復備份?
iOS上使用8/9斯威夫特2。
我已經自己解決了這個。 我會檢查我的備份文件是否可用,是否需要如果是這樣,我會開始下載,並通知用戶幾秒鐘後回來,而不是最好的解決方案,但現在它工作。
func checkAndDownloadBackupFile() -> Bool{
if(iCloudDocumentsURL != nil){
let file = iCloudDocumentsURL!.URLByAppendingPathComponent("backup.file")
let filemanager = NSFileManager.defaultManager();
if !filemanager.fileExistsAtPath(file.path!){
if filemanager.isUbiquitousItemAtURL(file) {
let alertView:UIAlertView = UIAlertView()
alertView.title = "Warning"
alertView.message = "iCloud is currently busy syncing the backup files. Please try again in a few minutes."
alertView.addButtonWithTitle("OK")
alertView.show()
do {
try filemanager.startDownloadingUbiquitousItemAtURL(file)
} catch{
print("Error while loading Backup File \(error)")
}
}
return false
} else{
return true
}
}
return true
}