Newbie thread question
Newbie thread question
- Subject: Newbie thread question
- From: Randall Meadows <email@hidden>
- Date: Tue, 3 Feb 2004 14:49:12 -0500
Ok, so I have the long process that I want to be cancel-able via a
"Cancel" button in my window. So as to not lock up the GUI I need to
move that long process into a thread, right?
In the action method of the button that kicks off the long process, I have:
[NSThread detachNewThreadSelector:@selector(doThreadedProcess)
toTarget:[ConverterWdw class] withObject:self];
where 'doThreadedProcess' is the method that actually does the long
process in the class 'ConverterWdw', which is not the same class as
where the above line of code lives.
That looked wonky when I wrote it, and sure enough I get this
*** Uncaught exception: <NSInvalidArgumentException> ***
+[ConverterWdw doThreadedProcess]: selector not recognized
when I execute it. I have a hint now, in that it's looking for
"+doThreadedProcess" instead of "-doThreadedProcess". ConverterWdw
is a subclass of NSObject, and is instantiated in my NIB file; is it
as simple a matter as changing the class definition to
"+(void)doThreadedProcess:(id)object;" instead of
"-(void)doThreadedProcess:(id)object;"?
Or, what is the proper approach to creating a thread to execute a
method in a different class?
--
randy
To see the two cutest kids ever, visit <
http://www.not-pc.com/>
You must know the rules.
Only then will you understand why you must break them.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.