Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sujithkrishnan

macrumors 6502
Original poster
May 9, 2008
265
0
Bangalore
Hi all,

I am having a util class and some method associated with it.

I am calling the someMethod in a detached thread using code shown below


Code:
[B]In AppDelegate.m[/B]

[NSThread detachNewThreadSelector:@selector(someMethod:) toTarget:utilClassObject  withObject:nil];

After the successful completion of thread i want to make a callback to method in AppDelegate class. But the below method (which i am supposed to use) is not having parameter to specify the target.

Below code will look for callBackMethod in utilClass
Code:
[B]In utilclass.m[/B]
[B]In someMethod[/B]
[self performSelectorOnMainThread:@selector(callbackMethod:) withObject:nil waitUntilDone:NO];
 
performSelectorOnMainThread:withObject:waitUntilDone: is called on the target object where the selector exists, so "self" is the target. Maybe it should be something like:

Code:
[[b]delegate[/b] performSelectorOnMainThread:@selector(callbackMethod:) withObject:nil waitUntilDone:NO];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.