FROM : Knut Lorenzen
DATE : Sun Feb 10 20:18:36 2008
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
DATE : Sun Feb 10 20:18:36 2008
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
| Related mails | Author | Date |
|---|---|---|
| Knut Lorenzen | Feb 10, 20:18 | |
| Kyle Sluder | Feb 11, 00:23 |






Cocoa mail archive

