嗨,我必须以**以下格式向 plist 添加一些数据,如下图**
但实际得到的就是这里
请帮助我的代码是..
-(void)updatePlist
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *pathOfPricePlist= [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Price.plist"];
NSMutableDictionary *mutableDictionary=[[NSMutableDictionary alloc]init];
NSMutableArray *finalList=[[NSMutableArray alloc]init];
for(int i=0;i<[sharedManager.bookidList count];i++) {
[mutableDictionary setValue:[sharedManager.sharedProductPrice objectAtIndex:i] forKey:@"price"];
[mutableDictionary setValue:[sharedManager.bookidList objectAtIndex:i] forKey:@"booknumber"];
NSLog(@"%@",mutableDictionary);
[finalList addObject:mutableDictionary];
NSLog(@"%@",finalList);
}
[finalList writeToFile:pathOfPricePlist atomically:YES];
}