• 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
Re: Bug in NSArrayController? (immutable instead of mutable dictionaries)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in NSArrayController? (immutable instead of mutable dictionaries)


  • Subject: Re: Bug in NSArrayController? (immutable instead of mutable dictionaries)
  • From: Scott Stevenson <email@hidden>
  • Date: Thu, 21 Oct 2004 15:06:18 -0700


On Oct 21, 2004, at 2:50 PM, Uli Zappe wrote:

According to the documentation, in this case [arrayController insert:self] is supposed to add a new NSMutableDictionary to the controller's content array. However, if, after this message call, you print [arrayController content] in the debugger, you get:

<CFArray 0x5bbb00 [0xa01900e0]>{type = immutable, count = 1, values = (
0 : <CFDictionary 0x52d960 [0xa01900e0]>{type = immutable, count = 0, capacity = 0, pairs = (
)}
)}

In other words, instead of a mutable dictionary, an *immutable* dictionary is added. What's more, the content array, which was mutable before, has also become immutable.

It's not clear to me what's causing this, but it's definitely not the typical behavior. If you're getting data from user defaults, that might be the issue. Post a test project or something.

For what it's worth, here's some I threw together in 60 seconds that does work (ignore the poor error checking in init):

@implementation MyController
- (id) init
{
self = [super init];
someArray = [[NSMutableArray alloc] init];
return self;
}
- (void) awakeFromNib
{
NSLog(@"awakeFromNib: %@", [arrayController content]);
[arrayController insert: self];
NSLog(@"after insert: %@", [arrayController content]);
}
@end

The output is:

awakeFromNib: <CFArray 0x305050 [0xa01900e0]>{type = mutable-small, count = 0, values = ()}

after insert: <CFArray 0x305050 [0xa01900e0]>{type = mutable-small, count = 1, values = (
0 : <CFDictionary 0x33b400 [0xa01900e0]>{type = mutable, count = 0, capacity = 4, pairs = (
)}
)}


- Scott



--
http://treehouseideas.com/
http://theobroma.treehouseideas.com/ [blog]
_______________________________________________
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
References: 
 >Bug in NSArrayController? (immutable instead of mutable dictionaries) (From: Uli Zappe <email@hidden>)

  • Prev by Date: simple bash script
  • Next by Date: Re: Copy and release
  • Previous by thread: Re: Bug in NSArrayController? (immutable instead of mutable dictionaries)
  • Next by thread: performance of adding subviews
  • Index(es):
    • Date
    • Thread