I want to pass a dict to the processit method. But as soon as I get access to the dictionary, I get EXC__BAD_INSTRUCTION.
NSNotificationCenter *ncObserver = [NSNotificationCenter defaultCenter]; [ncObserver addObserver:self selector:@selector(processit:) name:@"atest" object:nil]; NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:@"testing", @"first", nil]; NSString *test = [dict valueForKey:@"first"]; NSNotificationCenter *ncSubject = [NSNotificationCenter defaultCenter]; [ncSubject postNotificationName:@"atest" object:self userInfo:dict];
In the recipient method:
- (void) processit: (NSDictionary *)name{ NSString *test = [name valueForKey:@"l"];
Any suggestions on what I'm doing wrong?
objective-c iphone cocoa-touch nsnotifications
4thSpace
source share