Hi,
I'm trying to add NSMutableArray into plist file,I wrote the next read and write codes:
write code:
read code:
Favorites is an mutablearray:
when I'm trying to pull the NSMutableDictionary the count is 0,
why it's happening ?
Thanks a lot!
I'm trying to add NSMutableArray into plist file,I wrote the next read and write codes:
write code:
Code:
NSMutableDictionary *data1 = [[NSMutableDictionary alloc] initWithContentsOfFile: path];
//[data1 setObject:[NSNumber numberWithInt:value] forKey:@"value"];
[Favorites addObject:CheckInButton];
//[data1 setObject:Favorites forKey:@"niv"];
[data1 setObject:[NSMutableArray arrayWithArray:Favorites] forKey:@"niv"];
[data1 writeToFile: path atomically:YES];
[data1 release];
read code:
Code:
NSMutableDictionary *savedStock = [[NSMutableDictionary alloc] initWithContentsOfFile: path];
//value1 = [[savedStock objectForKey:@"value"] intValue];
NSMutableArray *Arr=[[NSMutableArray alloc]init];
Arr=[savedStock objectForKey:@"niv"];
NSLog(@"plist is %d",[Arr count]);
[savedStock release];
Favorites is an mutablearray:
Code:
Favorites=[[NSMutableArray alloc]init];
when I'm trying to pull the NSMutableDictionary the count is 0,
why it's happening ?
Thanks a lot!