• 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: NSNotificationCenter not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNotificationCenter not working


  • Subject: Re: NSNotificationCenter not working
  • From: Hiro Fujimoto <email@hidden>
  • Date: Thu, 1 Apr 2004 14:47:19 +0900

Matt,

I guess this construction should be following.

CallBack *callbacks = [[CallBack alloc] init];

I don't know it is course of your problem, but your code won't work
correctly.

--

On 2004/04/01, at 14:24, Matt Jaffa wrote:

> still to no avail is it working,
> I have this app that I downloaded that watches all Notifications from
> NSDistributedNotificationCenter.
>
> My System Preference Plugin is correctly posting notifications
>
> But my Foundation / CoreFoundation / Cocoa Daemon is not picking
> it up.
>
> My daemon has a main function with a included file for a obj-c class I
> made,
> That class is going to be the observer as here:
>
> int main() {
> ..........
> ........
> othercode
> ........
> .........
> CallBack * callbacks = [[CallBack init] alloc];
> [callbacks loadStuff];
> [[NSDistributedNotificationCenter defaultCenter] addObserver:callbacks
>
> selector:@selector(invertOff:)
>
> name:@"MFInvertOff" object:nil];
>
> daemon(0,0)
> while(...) {
> ......
> }
>
> release stuff etc.
>
> }
>
> Later in the code daemon(0,0) is called and it goes in a forever
> while loop using sockets to communicate with something else,
>
> Does this kind of scenario the thing that is killing my possibility to
> use NSDistributedNoticationCenters?
>
> this is my Callback class:
>
>
> #import "CallBack.h"
>
>
> @implementation CallBack
>
>
> - (void)loadStuff
> {
> conditional_val = 0;
>
> }
>
> - (int)returnCondition
> {
> return conditional_val;
> }
>
> - (void)setCondition:(int)condition
> {
> conditional_val = condition;
> }
>
> - (void)invertOn:(NSNotification *)myNotification
> {
> conditional_val = 0;
> printf("Inverton was called\n");
> }
> - (void)invertOff:(NSNotification *)myNotification
> {
> conditional_val = 1;
> printf("InvertOff was called\n");
> }
> @end
>
> Matt
>
> On Mar 31, 2004, at 8:40 PM, m wrote:
>
>> On Mar 31, 2004, at 7:27 PM, Matt Jaffa wrote:
>>
>>> hmmm even doing NSDistributedNotificationCenter is not working,
>>>
>>> here is what i am doing: I actually tried 2 ways and both didn't
>>> work
>>
>> [snip]
>>
>>> Receiver:
>>> [[NSDistributedNotificationCenter defaultCenter]
>>> addObserver:callbacks
>>>
>>> selector:@selector(invertOn)
>>>
>>> name:@"com.mf.inverton" object:@"com.mf.inverton"];
>>
>> Try adding a colon to your selector i.e. instead of
>> @selector(invertOn), use @selector(invertOn:)
>>
>> Make sure also that invertOn: has the proper signature, namely:
>>
>> -(void) invertOn:(NSNotification *)myNotification;
>>
>> Regards,
>>
>> _murat
>> _______________________________________________
>> 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.
> _______________________________________________
> 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.
>
>
------------------------------------------------------------------------
---------
hiro FUJIMOTO - developer in Japan.

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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: hi
  • Next by Date: Dealing with multiple tasks
  • Previous by thread: Re: NSNotificationCenter not working
  • Next by thread: Re: NSNotificationCenter not working
  • Index(es):
    • Date
    • Thread