Problem with NSArrayController and insert
Problem with NSArrayController and insert
- Subject: Problem with NSArrayController and insert
- From: Martin Linklater <email@hidden>
- Date: Fri, 04 Jan 2008 08:34:06 -0800
I'm trying to learn about bindings by writing some simple test Apps and getting things working. I've hit a problem that I'm not sure how to deal with...
I have an NSMutableArray called 'testArray' which is a member of my AppController class.
I have an NSArrayController called 'Array Controller' which is bound to my AppController and has the 'Model Key Path' set to 'testArray'
At the start of my application I manually init the testArray to have 4 NSString values. This works fine since I have bound an NSPopUpButton to my Array Controller and the entries show up fine.
I am now trying to insert a new NSString object into my array - I have set the action for an NSButton to my Array Controllers 'insert' method, but when I run my Application and hit the button I get the following output:
*** -[NSCFArray insertObject:atIndex:]: mutating method sent to immutable object
Which sounds like my Array Controller is dealing with an NSArray instead of an NSMutableArray.... but how can this be since I'm telling it to use my 'testArray' member, which is mutable ?
What bindings do I need to set up so that my 'Insert' button inserts a new NSString object into my array ?
Sorry if this is trivial - my head is busting from reading docs and I'm looking for a quick nudge in the right direction. The move the IB3.0 is also throwing me a little.
Thank you.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden