I was under the impression that with key-value coding, I could set any undefined attribute on a NSManagedObject at runtime and no exception would be thrown, but it wouldbe a way to hold objects attached to the model that are not in the data model.
For example, I have a Foo object that does not have a "bar" attribute. I though that at runtime, I could set it like so:
Foo *foo = [NSEntityDescription insertNewObjectForEntityForName:@"Foo" inManagedObjectContext:ManagedObjectContext];
[foo setValue:@"foobar" forUndefinedKey:@"bar"];
I would then expect the ManagedObjectContext to hold this value until I queried it later, but a save on the Managed Object Context would not store the bar value.
The famous error keeps popping up when I run this code:
the entity Foo is not key value coding-compliant for the key "bar"
..so my question is: What am I not getting or doing wrong?