<bdo id='lbh4D'></bdo><ul id='lbh4D'></ul>
<tfoot id='lbh4D'></tfoot>
  • <small id='lbh4D'></small><noframes id='lbh4D'>

  • <i id='lbh4D'><tr id='lbh4D'><dt id='lbh4D'><q id='lbh4D'><span id='lbh4D'><b id='lbh4D'><form id='lbh4D'><ins id='lbh4D'></ins><ul id='lbh4D'></ul><sub id='lbh4D'></sub></form><legend id='lbh4D'></legend><bdo id='lbh4D'><pre id='lbh4D'><center id='lbh4D'></center></pre></bdo></b><th id='lbh4D'></th></span></q></dt></tr></i><div id='lbh4D'><tfoot id='lbh4D'></tfoot><dl id='lbh4D'><fieldset id='lbh4D'></fieldset></dl></div>

    <legend id='lbh4D'><style id='lbh4D'><dir id='lbh4D'><q id='lbh4D'></q></dir></style></legend>
      1. iCloud:NSFileManager 的 startDownloadingUbiquitousItemAtURL 的

        时间:2023-05-31

        <legend id='Qnomb'><style id='Qnomb'><dir id='Qnomb'><q id='Qnomb'></q></dir></style></legend>

              <tbody id='Qnomb'></tbody>
          • <small id='Qnomb'></small><noframes id='Qnomb'>

            • <bdo id='Qnomb'></bdo><ul id='Qnomb'></ul>
                <i id='Qnomb'><tr id='Qnomb'><dt id='Qnomb'><q id='Qnomb'><span id='Qnomb'><b id='Qnomb'><form id='Qnomb'><ins id='Qnomb'></ins><ul id='Qnomb'></ul><sub id='Qnomb'></sub></form><legend id='Qnomb'></legend><bdo id='Qnomb'><pre id='Qnomb'><center id='Qnomb'></center></pre></bdo></b><th id='Qnomb'></th></span></q></dt></tr></i><div id='Qnomb'><tfoot id='Qnomb'></tfoot><dl id='Qnomb'><fieldset id='Qnomb'></fieldset></dl></div>

                  <tfoot id='Qnomb'></tfoot>
                1. 本文介绍了iCloud:NSFileManager 的 startDownloadingUbiquitousItemAtURL 的回调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在使用 NSFileManagerstartDownloadingUbiquitousItemAtURL 将文件从 iCloud 下载到本地副本(在这种情况下本地还没有文件的副本).我似乎找不到这个过程的回调.我需要回调来告诉我的应用程序请求的文件已完成下载(到本地副本),以便其他任务可以开始读取文件的内容并执行操作.

                  I am using NSFileManager's startDownloadingUbiquitousItemAtURL to download file from iCloud to local copy (the local does not yet have the copy of the file in this case). I can't seem to find the callback for this process. I need the callback to tell my app that the requested file is finished downloaded (to local copy) so other task can start reading the content of the file and does stuff.

                  我可以检查文件是否已下载.但它会涉及不断的轮询.有没有办法在不设置计时器来轮询的情况下做到这一点?

                  I can check to see if the file is downloaded. But it would involve in polling constantly. Is there a way to do this without setting a timer to poll for this?

                  推荐答案

                  我相信这个方法打算和基于Apple 的文档.所以你需要像这样使用文件协调器:

                  I believe that this method is intended to be used in conjunction with file coordinators based on Apple's documentation. So you would need to use a file coordinator like so:

                  NSURL *itemURL = nil; // this is the URL you want to read from
                  
                  __block NSData *data = nil;
                  NSError *error = nil;
                  NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil];
                  [coordinator coordinateReadingItemAtURL:itemURL options:0 error:&error byAccessor:^(NSURL *newURL) {
                      data = [NSData dataWithContentsOfURL:newURL];
                  }];
                  

                  不过,这将是同步的,因此如果您想异步执行某项操作,可以这样使用块:

                  This will be synchronous, however, so if you wanted to do something asynchronously, you could use blocks as so:

                  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                      // read info from the URL using the code above
                      dispatch_async(dispatch_get_main_queue(), ^{
                          // handle data read from the URL
                      });
                  });
                  

                  这篇关于iCloud:NSFileManager 的 startDownloadingUbiquitousItemAtURL 的回调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:未知类型名称“类";您指的是 'Class' 下一篇:iOS 中的 AES256 NSString 加密

                  相关文章

                  最新文章

                  1. <tfoot id='3vnXN'></tfoot>

                  2. <i id='3vnXN'><tr id='3vnXN'><dt id='3vnXN'><q id='3vnXN'><span id='3vnXN'><b id='3vnXN'><form id='3vnXN'><ins id='3vnXN'></ins><ul id='3vnXN'></ul><sub id='3vnXN'></sub></form><legend id='3vnXN'></legend><bdo id='3vnXN'><pre id='3vnXN'><center id='3vnXN'></center></pre></bdo></b><th id='3vnXN'></th></span></q></dt></tr></i><div id='3vnXN'><tfoot id='3vnXN'></tfoot><dl id='3vnXN'><fieldset id='3vnXN'></fieldset></dl></div>
                      <bdo id='3vnXN'></bdo><ul id='3vnXN'></ul>
                      <legend id='3vnXN'><style id='3vnXN'><dir id='3vnXN'><q id='3vnXN'></q></dir></style></legend>

                      <small id='3vnXN'></small><noframes id='3vnXN'>