0
我想创建我自己的NSNotificationCenter只是为了更好地编程。我遇到了一个EXC_BAD_ACCESS,我无法完成。创建我自己的NSNotificationCenter,存储对象?
我的方法:
- (void)addObserver:(id)observer forKey:(NSString *)theKey withSelector:(SEL)block {
NSString *selector = NSStringFromSelector(block);
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:observer, @"o",selector, "s", nil];
[[observers objectForKey:theKey] addObject:dict];
}
我的错误中NSDictionary *dict
初始化,我不明白为什么。正在添加的观察者是UIViewController
,如果这很重要,则在viewDidLoad
中调用此方法,该方法在applicationDidFinishLaunching
中运行。
我得到EXC_BAD_ACCESS错误代码= 1
任何帮助,将不胜感激,。
干杯。
它不可能像在''s“之前缺少'@'一样简单吗? – 2012-08-08 22:11:06