2

我正在尝试在 NSDistribtedNotificationCenter 中发布通知,但我在控制台中收到这些消息:

2011 年 3 月 22 日晚上 10:26:53 AIM[138] *尝试发布分布式通知 (AIMIncomingMessages),其中忽略了非字典 use​​rInfo(或无效属性列表)。

这是什么意思?

编辑:这是代码:

[[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];
4

1 回答 1

3

这意味着它所说的 - 当您使用 +notificationWithName:object:userInfo: 创建通知时,您为第三个参数 (userInfo) 传递的不是字典或其他属性列表类型,因此通知被忽略。如果您将用于创建问题通知的代码添加到您的问题中,我(或某人)可以为您提供更详细的建议,说明它到底出了什么问题。

(编辑)好的,现在您已经添加了代码:当您创建字典时,您已经向后列出了您的对象和键。它需要反过来,即 value, key, value, key 而不是 key, value, key, value。

于 2011-03-23T02:45:56.167 回答