user635064
user635064

Reputation: 6247

NSDistributedNotificationCenter notification failed?

I am trying to post a notification in NSDistribtedNotificationCenter but I get these messages in console:

3/22/11 10:26:53 PM AIM[138] * Attempt to post a distributed notification (AIMIncomingMessages) with a non-dictionary userInfo (or one which is not a valid property list) ignored.

What does this mean?

EDIT: Here's the code:

[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"AIMIncomingMessages"
                                                               object:nil
                                                             userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                       @"Event Source", [NSNumber numberWithInt:3],
                                                                       @"Message:", [arg2 attributedString],
                                                                       @"Username:", [arg3 name],
                                                                       @"Timestamp:", [NSDate date],
                                                                       nil]
                                                   deliverImmediately: YES];

Upvotes: 2

Views: 1188

Answers (1)

Sherm Pendley
Sherm Pendley

Reputation: 13612

It means just what it says - When you created the notification with +notificationWithName:object:userInfo:, what you passed for the third argument (userInfo) wasn't a dictionary or other property list type, so the notification is being ignored. If you add the code you're using to create the notification to your question, I (or someone) can give you more detailed advice about exactly what's wrong with it.

(Edit) Okay, now that you've added the code: You've listed your objects and keys backwards when you create the dictionary. It needs to be the other way around, i.e. value, key, value, key instead of key, value, key, value.

Upvotes: 3

Related Questions