2013-08-20 89 views

回答

3

是,其相同的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]; 
} 

世界上没有错误在片段,你会希望在生产代码做处理。