Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.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 ASIHTTPRequest和NSOperations-还有其他方法实现多线程吗?_Iphone_Objective C_Multithreading_Xcode_Cocoa Touch - Fatal编程技术网

Iphone ASIHTTPRequest和NSOperations-还有其他方法实现多线程吗?

Iphone ASIHTTPRequest和NSOperations-还有其他方法实现多线程吗?,iphone,objective-c,multithreading,xcode,cocoa-touch,Iphone,Objective C,Multithreading,Xcode,Cocoa Touch,除了ASIHTTPRequest和使用NSOperations之外,还有什么其他方法可以实现多线程?如果有其他实现多线程的方法,请提供链接。 我们还可以为音频流实现多线程,以便从url检索。看看这个方法: [NSThread detachNewThreadSelector:@selector(entryPointMethodForSecondThread) toTarget:objectWhereEntryPMethodDeclarated withObject:nil]; 请注意,必须在“入

除了ASIHTTPRequest和使用NSOperations之外,还有什么其他方法可以实现多线程?如果有其他实现多线程的方法,请提供链接。
我们还可以为音频流实现多线程,以便从url检索。

看看这个方法:

[NSThread detachNewThreadSelector:@selector(entryPointMethodForSecondThread) toTarget:objectWhereEntryPMethodDeclarated withObject:nil];
请注意,必须在“入口点方法”中为其创建自动释放池。
详细信息请参见NSThread规范。

因此我们可以使用NSThread创建线程,您的意思是我们也可以在其他单独的线程中调用另一个线程???NSThread这里是一个类。它有一个静态方法detachNewThreadSelector:toTarget:withObject:。它将创建一个新线程,而您的活动线程将继续,从传递给“toTarget”参数的函数开始。别忘了在该函数中创建一个自动释放池。好的,但我想知道entrypointMethodForSecondThread方法将在单独的线程中执行???是的:您的主线程或活动线程将通过我在回答中提供的行,继续它的工作;第二个线程将在该行创建,并将从entrypointMethodForSecondThread开始工作。