• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Bindings/archiving: NSMutableDictionary errors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bindings/archiving: NSMutableDictionary errors


  • Subject: Bindings/archiving: NSMutableDictionary errors
  • From: Mike Carter <email@hidden>
  • Date: Wed, 4 May 2005 22:12:07 -0700

Hello all.

I have a non-document Cocoa app that has at it's core a controller object with 2 mutable arrays that hold a collection of objects. I am writing this graph out to a file in the user's Application Data directory. When I create the objects through the main window, I can change all the settings as expected. When I start the app the next time, I load in the object graph and set the 2 arrays. From that point on, I can't make any changes to the two arrays. I get the following error:

2005-05-04 20:55:47.592 CCLS Route[4962] *** -[NSCFDictionary setObject:forKey:]: mutating method sent to immutable object

I can, however, make changes to a couple other objects associated with the arrays. All the data is preserved correctly, just immutable.

@interface AppController : NSObject
{
// model
NSMutableArray *routes; // array of routelists
NSMutableArray *emps; // array of employees


    [...]

All of my data model objects use a NSMutableDictionary to store instance variables:

- (id) init {
if( self = [super init] ) {
NSArray * keys = [NSArray arrayWithObjects: @"name", @"owner", nil];
NSArray * values = [NSArray arrayWithObjects: @"Route list", [Employee employee], nil];


properties = [[NSMutableDictionary alloc] initWithObjects: values forKeys: keys];

        jobs = [[NSMutableArray alloc] init];
    }
    return self;
}

Where should I start looking for this error? When I initially input the data, there are no problems changing any of the values.
All of the key-value glue is made through bindings.


Thanks!

_________________________
Mike Carter
Aviate.Org :: Systems Admin
iChat: PilotMike :: PGP-0x71E5B44C

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Bindings/archiving: NSMutableDictionary errors
      • From: Scott Anguish <email@hidden>
  • Prev by Date: Re: kEventParamMenuRef (was: _NSGetCarbonMenu) SOLVED
  • Next by Date: Re: kEventParamMenuRef (was: _NSGetCarbonMenu)
  • Previous by thread: Re: Setting the contents of an NSTokenField programatically
  • Next by thread: Re: Bindings/archiving: NSMutableDictionary errors
  • Index(es):
    • Date
    • Thread