[baseten-users] NSNotfications Bug

Michael Ruepp michael at ruepp.at
Thu Oct 8 22:04:13 EEST 2009


When register for Notification on a context with two tables  and a one  
to many relationship, (Groups -> Persons) with this code:

		NSNotificationCenter* ctx_ns_center = [context_ notificationCenter];
		NSLog(@"Ctx ns center: %@",(NSString*)ctx_ns_center);
		[ctx_ns_center addObserver:self
					  selector:@selector(contextChanged:)
						  name:kBXInsertNotification object:nil];
		[ctx_ns_center addObserver:self
						  selector:@selector(contextChanged:)
							  name:kBXUpdateNotification object:nil];
		[ctx_ns_center addObserver:self
						  selector:@selector(contextChanged:)
							  name:kBXDeleteNotification object:nil];


and that method:

-(void)contextChanged:(NSNotification *)notification
{
	id theObject = [notification object];
	NSLog(@"insertedObjects = %@",theObject);
	
	if (![notification name])  {
		return;
	}
	[self doSomething]];
	
}

the notification is only called when insert, update or delete in the  
"to one" Table, eg. the Groups Table.

But Notification is set up for the whole context, as my understanding  
is???


Cheers, Mike



_________________
michael ruepp
michael at ruepp.at
fon +41 76 593 04 49
skype michaelruepp

CONFIDENTIALITY NOTICE
This message (including any attachments transmitted with it) contains  
confidential information and is intended only for the individual named  
herein. If you are not the herein named addressee you should not  
disseminate, distribute, copy or otherwise make use of this message.  
Please notify the sender immediately by e-mail if you have received  
this message by mistake, and delete it from your systems.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basetenframework.org/pipermail/baseten-users/attachments/20091008/f5619ec3/attachment.htm>


More information about the baseten-users mailing list