startDownloadingUbiquitousItemAtURL:error
方法在哪里将下载的文件保存在本地?
与给定的一样URL
吗?
是的,它是相同的网址
从iCloud下载到设备之前就位的文件是一种占位符。
您可以使用键检查URL的状态 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];
}
您希望在生产代码中执行的代码段中没有错误处理。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句