【问题标题】:startDownloadingUbiquitousItemAtURL local file path?startDownloadingUbiquitousItemAtURL 本地文件路径?
【发布时间】:2013-08-22 08:17:24
【问题描述】:

startDownloadingUbiquitousItemAtURL:error方法将下载的文件保存在本地哪里?
和给定的URL一样吗?

【问题讨论】:

    标签: iphone ios objective-c ipad icloud


    【解决方案1】:

    是的,同一个网址

    从 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 中没有您想要在生产代码中执行的错误处理。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-27
      • 2018-10-11
      • 1970-01-01
      • 2014-05-18
      • 1970-01-01
      • 2017-07-19
      • 2023-04-01
      • 1970-01-01
      相关资源
      最近更新 更多