Re: MutableDictionary not adding objects?
Re: MutableDictionary not adding objects?
- Subject: Re: MutableDictionary not adding objects?
- From: mmalcolm crawford <email@hidden>
- Date: Sun, 25 Jan 2004 17:12:03 -0800
On Jan 25, 2004, at 4:16 PM, email@hidden wrote:
ok so i have this code to cycle through an array check the values add
them to other dictionaries and arrays then output it to a file the
problem is the tempDict's being added are empty when i open the xml
file output? does anything look wrong with this code?
It's difficult to see exactly what your intent is, but you're
manipulating the same dictionary object throughout. Is that what you
want to do, or should it be more like this?
NSEnumerator *e = [fieldsArray objectEnumerator];
id object;
// NSMutableDictionary *tempDict = [NSMutableDictionary dictionary];
NSMutableArray *tempArray = [NSMutableArray array];
while(object = [e nextObject])
{
if ([object isEqualToString:@":"])
{
[ABCMenusArray addObject:tempArray];
[tempArray removeAllObjects];
}
else if ([object isEqualToString:@"sep"])
{
NSMutableDictionary *tempDict = [NSMutableDictionary dictionary];
[tempDict setObject:@"sep" forKey:@"sep"];
// NSDictionary * tempDict = [NSDictionary dictionaryWithObject:@"sep"
forKey:@"sep"];
[tempArray addObject:tempDict];
// [tempDict removeAllObjects];
}
else
{
NSMutableDictionary *tempDict = [NSMutableDictionary dictionary];
[tempDict setObject:object forKey:@"item"];
[tempDict setObject:[NSNumber numberWithBool:NO]
forKey:@"statsus"];
// statsus or status?
[tempArray addObject:tempDict];
// [tempDict removeAllObjects];
}
}
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.