Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.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
Objective c NSURLConnection在backgorund中发出同步请求_Objective C - Fatal编程技术网

Objective c NSURLConnection在backgorund中发出同步请求

Objective c NSURLConnection在backgorund中发出同步请求,objective-c,Objective C,像标题一样,我的问题是,是否有可能在后台发出同步请求。 我的实际代码是: NSData *dataReply = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error]; 不仅可能,实际上这是推荐的方法,最好是在自己的线程上调用它。另一方面,异步调用更好 查看NSThread detachNewThreadSelector:toTarget:wit

像标题一样,我的问题是,是否有可能在后台发出同步请求。 我的实际代码是:

NSData  *dataReply = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error];

不仅可能,实际上这是推荐的方法,最好是在自己的线程上调用它。另一方面,异步调用更好

查看NSThread detachNewThreadSelector:toTarget:withObject。