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, jonat...@mugginsoft.com < jonat...@mugginsoft.com> 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, jonat...@mugginsoft.com < > jonat...@mugginsoft.com> 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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com