Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 在X时间内使用线程从url获取数据_Iphone_Objective C - Fatal编程技术网

Iphone 在X时间内使用线程从url获取数据

Iphone 在X时间内使用线程从url获取数据,iphone,objective-c,Iphone,Objective C,在objective c中,我需要从背景(线程)中的url获取数据,并使用一段时间 什么主意 nsthread 派遣 performSelectorInBackground您可以使用GCD的dispatch\u after() // Delay execution of my block for 2 seconds. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC), dispatch_get_global_que

在objective c中,我需要从背景(线程)中的url获取数据,并使用一段时间

什么主意

nsthread 派遣
performSelectorInBackground

您可以使用GCD的
dispatch\u after()

// Delay execution of my block for 2 seconds.
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    // Do whatever you want in the background here.
});