Re: NSDistributedNotification in a Foundation tool
Re: NSDistributedNotification in a Foundation tool
- Subject: Re: NSDistributedNotification in a Foundation tool
- From: Alex Rice <email@hidden>
- Date: Sun, 12 Jan 2003 14:42:10 -0700
On Sunday, January 12, 2003, at 03:31 AM, Finlay Dobbie wrote:
On Sunday, January 12, 2003, at 08:42 am, Alex Rice wrote:
I am trying to receive a NSDistributedNotification in a Foundation
tool. But it the tool finishes running before any
NSDistributedNotifications are received. Do I have to do something
with NSRunLoop to receive the notifications?
Yes, you'll need to run the runloop.
Thanks, but I'm still not getting it. Does there have to be anything
special done with the runloop mode, or ports?
Here is the main() of my app. I have putting calls to [[NSRunLoop
currentRunLoop] run] both within the -scan method and at the end of my
main() function.
#import <Cocoa/Cocoa.h>
#import "SlackerMinder.h"
int main (int argc, const char * argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SlackerMinder *minder = [[SlackerMinder alloc] init];
[[NSDistributedNotificationCenter defaultCenter] addObserver: minder
selector: @selector(slackerLaunchedNotification:)
name: MLSlackerLaunchedNotification
object: nil];
int retval = [minder scan]; // Slacker.app may be launched here
[minder release];
[pool release];
return retval;
}
Alex Rice <email@hidden> | Mindlube Software |
http://mindlube.com
what a waste of thumbs that are opposable
to make machines that are disposable Ani DiFranco
_______________________________________________
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.