I know I can do:
[managedObject setValue:val forKey:@"key"];
But how do I add an object to a many-relationship nsorderedset? I’ve got a feeling I can’t just:
NSOrderedSet * set = [managedObject objectForKey:@"therelationship"];
[set addObject:relationshipObj];
[managedObject setValue:set forKey:@"therelationship"];
Or can I?
You can, but since ios4.0 they’ve been trying to stray away from setting values on NSManagedObjects with KVO. Apple wants you to make an NSManagedObject subclass. You’re implementation would become something like this.
check out the “mastering coredata” in the wwdc 2010 video set.