• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Newbie thread question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Newbie thread question
      • From: Dustin Voss <email@hidden>
    • Re: Newbie thread question
      • From: Herr Witten <email@hidden>
  • Prev by Date: Re: Cocoa/Windows parallel dvlpmt
  • Next by Date: Re: Swapping the NSTextContainer on an NSTextView
  • Previous by thread: Re: NSXMLParser Round-Tripping
  • Next by thread: Re: Newbie thread question
  • Index(es):
    • Date
    • Thread