Re: Vending Objects in DO
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.