startDownloadingUbiquitousItemAtURL:error
方法在哪里将下载的文件保存在本地?
是否与给定的URL
相同?
答案 0 :(得分:3)
是的,它的网址相同
从iCloud下载到设备之前的文件是各种各样的占位符。
您可以使用密钥NSURLUbiquitousItemIsDownloadedKey
NSURL *foo = file://cloud/container/reference/tofile;
NSNumber *isDownloadedValue = NULL;
BOOL success = [foo getResourceValue:&isDownloadedValue forKey: NSURLUbiquitousItemIsDownloadedKey error:NULL];
if (success && ![isDownloadedValue boolValue]) {
[[NSFileManager defaultManager] startDownloadingUbiquitousItemAtURL:foo error:NULL];
}
在您希望在生产代码中执行的代码段中没有错误处理。