Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在单独的线程中运行类方法(以“+”开头)?通常我会调用[myClass myController];我尝试[NSThread detachNewThreadSelector:myController toTarget:myClass withObject:nil];但没有成功的方法。
[myClass myController];
[NSThread detachNewThreadSelector:myController toTarget:myClass withObject:nil];
是的,您只需要制作目标[myClass class]而不是myClass. 此外,您忘记@selector()在选择器名称周围使用。所以你要:
[myClass class]
myClass
@selector()
[NSThread detachNewThreadSelector:@selector(myController) toTarget:[myClass class] withObject:nil];