如何在 ios5 中使用调度方法将记录上传到服务器



我的本地文件中有 500 条记录。我想使用 NSURL 中的调度方法将文件上传到服务器。我的想法是记录数达到 50,然后使用 dispatch_queue 上传为先到先出的方法。我该怎么做

由于您有大量文件,因此最好使用performSelectorInBackground或dispatch_async线程。

dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(queue, ^{
    // code to post on server
});

这是关于dispatch_async http://blog.slaunchaman.com/2011/02/28/cocoa-touch-tutorial-using-grand-central-dispatch-for-asynchronous-table-view-cells/的好帖子

最新更新