对于该方法:
[NSThread detachNewThreadSelector:@selector(method:) toTarget:self withObject:(id)SELECTOR];
如何传递一个 @selector?我尝试将其转换为 (id) 以使其编译通过,但会在运行时崩溃。
更具体地说,我有一个像这样的方法:
+(void)method1:(SEL)selector{
[NSThread detachNewThreadSelector:@selector(method2:) toTarget:self withObject:selector];
}
它崩溃了。如何在不崩溃的情况下传入选择器,以便当线程准备好时,新线程可以调用该选择器?