Is it possible to run a class method (starting with a '+') in a separate thread? Normally I call the method like [myClass myController];
I tried [NSThread detachNewThreadSelector:myController toTarget:myClass withObject:nil];
without success.
views:
92answers:
1
+2
A:
Yes, you just need to make the target [myClass class]
instead of myClass
. Also you forgot to use @selector()
around the selector name. So you want:
[NSThread detachNewThreadSelector:@selector(myController) toTarget:[myClass class] withObject:nil];
invariant
2010-04-02 16:52:58
Thank you. The @selector part was a typo sorry. Works perfectely.
Jeroen Sterckx
2010-04-02 17:05:29
Cool. Welcome to StackOverflow!
invariant
2010-04-02 17:11:38