Objective-c – How to make a piece of code run in a separate thread

cocoaiphonemultithreadingobjective-c

I have a few method calls like this:

[self myFoo];
[self heavyStuff]; // this one in other thread
[self myBar];

which classes / methods do I have to look at? When I search for "thread", there comes a lot of classes, methods and functions. Which one's are most apropriate here?

Best Solution

You would do

[self performSelectorInBackground:@selector(heavyStuff) withObject:nil];

See the NSObject reference on Apple's site.