Skip navigation.
 
mlRe: performSelectorOnMainThread problem
FROM : Dave Hersey
DATE : Thu Mar 13 03:03:29 2008

You definitely should specify the colon, but I suspect this points to 
a bigger problem:

>>> I have imported the main AppController.h into this secondary class 
>>> file.



The "secondary class" part makes me wonder. Is this method actually 
defined in the object where you're calling 
performSelectorOnMainThreadFrom? That's what you're saying by passing 
self.

If not, you need to refer to the class/object it's in. So, if 
"updateProgress:" is defined in your app controller and you have a 
reference to that, you might do something like:

[m_appController 
performSelectorOnMainThread:@selector(updateProgress:) withObject:data 
waitUntilDone:YES];

If you don't have a reference to the app controller, you can use 
(AppController *) [NSApp delegate] for the first parameter, if the app 
delegate is also your app controller.

In any case, the first parameter should be an object that responds to 
the selector you're passing. Either that's not the case, or the 
selector you're passing is incorrect.

- d


On Mar 12, 2008, at 9:32 PM, Nick Rogers wrote:

> Yes I was using updateProgress with the colon earlier, but still 
> didn't worked.
>
> Wishes,
> Nick
>
> On 13-Mar-08, at 7:00 AM, John Stiles wrote:
>

>> If -updateProgress is taking "data" as an argument, then you 
>> probably want
>>    @selector(updateProgress:)
>>
>> Note the colon.
>>
>> Nick Rogers wrote:

>>>
>>> Hi,
>>> In my secondary thread I'm doing:
>>> [self performSelectorOnMainThread:@selector(updateProgress) 
>>> withObject:data waitUntilDone:YES];
>>>
>>> with the error that self does not recognize the selector 
>>> updateProgress.
>>> I have imported the main AppController.h into this secondary class 
>>> file. still the problem.
>>>
>>> Regards,
>>> Nick

Related mailsAuthorDate
mlperformSelectorOnMainThread problem Nick Rogers Mar 13, 02:27
mlRe: performSelectorOnMainThread problem John Stiles Mar 13, 02:30
mlRe: performSelectorOnMainThread problem Nick Rogers Mar 13, 02:32
mlRe: performSelectorOnMainThread problem John Stiles Mar 13, 02:44
mlRe: performSelectorOnMainThread problem Nick Rogers Mar 13, 03:00
mlRe: performSelectorOnMainThread problem Dave Hersey Mar 13, 03:03
mlRe: performSelectorOnMainThread problem Thomas Engelmeier Mar 13, 10:16