• 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: Inter-Application Communication in Cocoa ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inter-Application Communication in Cocoa ?


  • Subject: Re: Inter-Application Communication in Cocoa ?
  • From: Paul Collins <email@hidden>
  • Date: Fri, 13 Sep 2002 15:32:01 -0700

Thanks for the response David! Here's my code. The issue is that the
receiving process finds the "object" in the NSNotification to be nil
instead of the string that was sent.

Sender application:
#define kNotDialCommand @"com.gracion.DTdial"

- (IBAction)dialOrHang:(id)sender {
NSDistributedNotificationCenter *notiCenter =
[NSDistributedNotificationCenter defaultCenter];
NSString *objStr;
int i;

...

if ([[sender title] isEqualToString:@"Connect"]) {
//[notiCenter postNotificationName:kNotDialCommand
object:objStr];
[notiCenter postNotificationName:kNotDialCommand
object:@"hello"];
}
...
}

Receiver process (a Foundation tool launched from the terminal as root
(using sudo)):
- (id)init {
self = [super init];
[[NSDistributedNotificationCenter defaultCenter] addObserver:self

selector:@selector(dialCmd:)

name:kNotDialCommand
object:nil

suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce];
[[NSDistributedNotificationCenter defaultCenter] addObserver:self

selector:@selector(hangupCmd:)

name:kNotHangupCommand
object:nil

suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce];
return self;
}
- (void)dialCmd:(NSNotification*)noti {
SYSLog(LOG_INFO,@"DIAG: pcontrol got dialCmd noti. object = -%@-",
[noti object]);
// logs "DIAG: pcontrol got dialCmd noti. object = -(null)-"
// gdb po [noti object] returns <nil> here
[self doDial:[noti object]];
}
_______________________________________________
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.

  • Prev by Date: RE: Inter-Application Communication in Cocoa ?
  • Next by Date: Re: Please help! Dynamically changing the NSTableView header ?
  • Previous by thread: Re: Inter-Application Communication in Cocoa ?
  • Next by thread: RE: Inter-Application Communication in Cocoa ?
  • Index(es):
    • Date
    • Thread