Question

I've a problem with KVO and I just can't find out what it is.

I have a screen that can be used to edit or create a record. That record is represented by a model object that holds a number of variables of type NSString.

The controller for that string has an instance variable to hold the model currently being worked on. When I open the window to create a new record, I create a new entity on my managed object context, assign the newly created entity to that instance variable and display the window - no problems.

I am using manual notifications in some fields of my model object because it inherits from NSManagedObject.

But when I try to edit a record - by fetching it from Core Data and doing the same thing - I get the error: [ addObserver:forKeyPath:options:context:] is not supported. Key path: username

NSLogging the object shows that its of the correct type. Any clues?

Was it helpful?

Solution

That error make it feel like a set is involved somewhere. Are you sure you're setting the instance variable to the model object directly, instead of a set of them (possibly even a set with only one member)?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top