【发布时间】:2013-08-22 08:17:24
【问题描述】:
startDownloadingUbiquitousItemAtURL:error方法将下载的文件保存在本地哪里?
和给定的URL一样吗?
【问题讨论】:
标签: iphone ios objective-c ipad icloud
startDownloadingUbiquitousItemAtURL:error方法将下载的文件保存在本地哪里?
和给定的URL一样吗?
【问题讨论】:
标签: iphone ios objective-c ipad icloud
是的,同一个网址
从 iCloud 下载到设备之前的文件是一种占位符。
您可以使用NSURLUbiquitousItemIsDownloadedKey 键检查 URL 的状态
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];
}
在该 sn-p 中没有您想要在生产代码中执行的错误处理。
【讨论】: