gpt4 book ai didi

ios - 保存在 iCloud Drive 上的文档似乎无法在 iOS 上下载

转载 作者:行者123 更新时间:2023-11-28 06:56:31 26 4
gpt4 key购买 nike

我会让用户使用 iCloud 驱动器保存他的数据备份。效果很好。但是,如果我切换到另一个支持 iCloud Drive 的设备,我将无法读取该文件。

我可以在 iCloud Drive 应用程序中看到备份文件,但它没有下载,(它显示“从 icloud 符号下载”)。

如果用户想要恢复备份,是否可以强制下载目录中所有可用的文件?

在 iOS 8/9 上使用 Swift 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
}

关于ios - 保存在 iCloud Drive 上的文档似乎无法在 iOS 上下载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33462352/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com