• 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
Object vanished before it is removed?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Object vanished before it is removed?


  • Subject: Object vanished before it is removed?
  • From: Knut Lorenzen <email@hidden>
  • Date: Sun, 10 Feb 2008 20:18:36 +0100

Hi all,

I am trying to loop through an NSMutableArray of NSMutableDictionaries, extract archived NSColors, convert them to hexValues and then remove the NSColor from the NSArray. Here's the code:

int row;
for (row = 0; row < [theArray count]; row++) {
NSMutableDictionary *testDic = [NSMutableDictionary dictionaryWithDictionary: [theArray objectAtIndex: row]];


NSColor *bgColor = (NSColor *)[NSUnarchiver unarchiveObjectWithData: [testDic valueForKeyPath: @"OUTPUT_WINDOW_SETTINGS.NSBACKGROUND_COLOR"]];

	[[testDic valueForKey: @"OUTPUT_WINDOW_SETTINGS"]
			setObject: [bgColor hexadecimalValueOfAnNSColor]
			     forKey: @"BACKGROUND_COLOR"];

NSLog(@"%@ has the value %@", [testDic valueForKey: @"NAME"] , [testDic valueForKeyPath: @"OUTPUT_WINDOW_SETTINGS.NSBACKGROUND_COLOR"]);

[[testDic valueForKey: @"OUTPUT_WINDOW_SETTINGS"] removeObjectForKey: @"NSBACKGROUND_COLOR"];
}


The problem is, after the first loop, the log reads:

Testdata1 has the value <040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016301 84046666 66660000 010186>
Testdata2 has the value (null)
*** -initForReadingWithData: nil argument


But Testdata2 does exist and has the appropriate value (checked with NSLog). What am I missing?

Cheers,

Knut

_______________________________________________

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


  • Follow-Ups:
    • Re: Object vanished before it is removed?
      • From: "Kyle Sluder" <email@hidden>
  • Prev by Date: Re: self = [super init] debate.
  • Next by Date: Re: self = [super init] debate.
  • Previous by thread: Re: Xcode 3.0, is it missing the Close Project menu item? sorry group
  • Next by thread: Re: Object vanished before it is removed?
  • Index(es):
    • Date
    • Thread