• 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
Re: Vending Objects in DO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vending Objects in DO


  • Subject: Re: Vending Objects in DO
  • From: Douglas Davidson <email@hidden>
  • Date: Fri, 11 Apr 2003 10:38:20 -0700

On Friday, April 11, 2003, at 3:13 AM, Craig Bakalian wrote:

Can one vend and object in a init method of a NSWindowController? By vend I mean the standard code snip below:

MyServerObject *server = [[MyServerObject alloc] init];
NSConnection *conn;

conn = [NSConnection defaultConnection];
[conn setRootObject: server];
[conn registerName: @"server"];
[[NSRunLoop currentRunLoop] configureAsServer];
[[NSRunLoop currentRunLoop] run];

The only vending DO examples I can find out there in documentation land are placed inside the body of main().
Does the above have to be in main()?

If you are in the main thread of an application, then NSApplication will be running the run loop for you, and you should omit the last two lines of your snippet. Also, you may wish to create a new connection rather than using the default connection, in case you end up vending more than one object.

Douglas Davidson
_______________________________________________
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.

References: 
 >Vending Objects in DO (From: Craig Bakalian <email@hidden>)

  • Prev by Date: Re: WebCore revisted
  • Next by Date: Re: NSTextView with 50% transparent background
  • Previous by thread: Vending Objects in DO
  • Next by thread: Problem with NSSet's containsObject: and member: methods
  • Index(es):
    • Date
    • Thread