Search code examples
cocoansarraycontrollerkey-value-coding

Modifying value of NSArrayController object causes errors


I have an NSArrayController, and I'm trying to modify a value of the selected object. I am using

[[[ideasListController selectedObjects] objectAtIndex:0] setValue:@"test" forKey:@"title"];

to try and change the title, but this results in an error:

[<__NSDictionaryI 0x10065e6c0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key title.

I'm fairly new to Cocoa and Objective-C, so I'm afraid I might be missing something rather obvious here.


Solution

  • Your dictionary is immutable (thats what the "I" in <__NSDictionaryI 0x10065e6c0> means), so that's why you get error messages when you try to change it.