NSMutableDictionary-在将键值对设置为字典时出错

问题描述

|| 我收到以下代码错误
@interface event : NSObject
{
NSMutableDictionary  m_cAppIdMap;  //error:statically allocated instance of Objective C
}
@end
我通过事件实现中的create函数将对象设置为字典。
[m_cAppIdMap setobject:pEvent forKey:[NSNumber numberWithUnsignedInt:wTimerId]]; //Error:Cannot convert to a pointer type
这是我在字典上设置结构对象的方式。 pEvent是包含5个字段的结构,而wTimerId是无符号的短整数(键)。     

解决方法

您的ivar应该是一个指针。
NSMutableDictionary*  m_cAppIdMap;