Re: Can NSNotificationCenter Memorize Old Events?
Re: Can NSNotificationCenter Memorize Old Events?
- Subject: Re: Can NSNotificationCenter Memorize Old Events?
- From: Bing Li <email@hidden>
- Date: Mon, 06 Jun 2011 20:34:40 +0800
Dear Jonathan,
Thanks! I tried. Obj-C string is not the reason to the problem.
Best,
Bing
On Mon, Jun 6, 2011 at 6:53 PM, email@hidden <
email@hidden> wrote:
> HI Bing
>
> I don't know why the note center is behaving as it is but you have used C
> strings where you should have used Obj-C string literals (note the @).
> This may be the source of the weird behaviour.
>
> Regards
>
> Jonathan Mitchell
>
> Developer
> Mugginsoft LLP
> http://www.mugginsoft.com
>
>
>
>
>
>
>
> On 6 Jun 2011, at 11:38, Bing Li wrote:
>
> Dear Jonathan,
>
> Thanks so much for your reply!
>
> But I don't understand what you said. Could you explain that much?
>
> Best regards,
> Bing
>
> On Mon, Jun 6, 2011 at 6:17 PM, email@hidden <
> email@hidden> wrote:
>
>>
>> On 6 Jun 2011, at 10:51, Bing Li wrote:
>>
>> > // The lines are used to save message in a dictionary to transmit
>> > with the notification
>> > NSMutableDictionary *messageDictionary = [[[NSMutableDictionary
>> > alloc] initWithCapacity:5] autorelease];
>> > [messageDictionary setObject:message forKey:"RECEIVED_MESSAGE"];
>> Try:
>>
>> [messageDictionary setObject:message forKey:@"RECEIVED_MESSAGE"];
>>
>> >
>> > // To my surprise, the line is invoked the same times as the
>> times
>> > the client initializes a connection even though the client just sends
>> only
>> > one message after each connection is initialized
>> > [[NSNotificationCenter defaultCenter]
>> > postNotificationName:"MESSAGE_RECEIVED" object:self
>> > userInfo:messageDictionary];
>> > }
>> Try:
>>
>> [[NSNotificationCenter defaultCenter]
>> postNotificationName:@"MESSAGE_RECEIVED" object:self
>> userInfo:messageDictionary];
>>
>> Regards
>>
>> Jonathan Mitchell
>>
>> Developer
>> Mugginsoft LLP
>> http://www.mugginsoft.com
>>
>>
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden