Skip navigation.
 
mlRe: NSDistributedNotification in a Foundation tool
FROM : Alex Rice
DATE : Sun Jan 12 22:42:10 2003

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_removed>> | 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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlNSDistributedNotification in a Foundation tool Alex Rice Jan 12, 09:42
mlRe: NSDistributedNotification in a Foundation tool Finlay Dobbie Jan 12, 11:31
mlRe: NSDistributedNotification in a Foundation tool Alex Rice Jan 12, 22:42
mlRe: NSDistributedNotification in a Foundation tool Alex Rice Jan 13, 05:27