startDownloadingUbiquitousItemAtURL本地文件路径?

时间:2013-08-20 10:08:57

标签: iphone ios objective-c ipad icloud

startDownloadingUbiquitousItemAtURL:error方法在哪里将下载的文件保存在本地?
是否与给定的URL相同?

1 个答案:

答案 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];
}

在您希望在生产代码中执行的代码段中没有错误处理。