检索数据您好,我有以下格式如何从plist中
我想根据自己的类别ID这些书整理的plist中。我有一个数组“TotalCategory”与所有类别的ID(如:CAT1,CAT2 ..),我想打开下面的plist与每本书和它的类ID是否与其匹配的或not.If类别ID我已经是检查与给定书籍的类别ID匹配,然后我想将该类别ID和书籍ID(出价)添加到新字典中。是否有可能?
NSDictionary *booksPlist = [[NSDictionary alloc] initWithContentsOfFile:path];
NSArray *categoryId=[[booksPlist objectForKey:@"catlist"]valueForKey:@"cid"];
NSLog(@"%@",categoryId);
// getting category list
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *allBooksPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Allbooks.plist"];
NSDictionary *allBookPlist=[[NSDictionary alloc]initWithContentsOfFile:allBooksPath];
NSArray *bookid=[[allBookPlist objectForKey:@"listbook"]valueForKey:@"bid"];
NSString *s=[[[allBookPlist objectForKey:@"listbook"]objectForKey:@"cate" ]valueForKey:@"categories"]; //// this line shows exception
NSLog(@"%@",s);
///我想要这个::: 我要检查类别ID与我和类别ID的每本书里面如果匹配,然后检索书ID(BID)那它
这不是一个Xcode的问题。 – 2013-04-08 19:06:50
IAM这样使用Xcode的 – Naveen 2013-04-08 19:08:18
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/SerializePlist/SerializePlist.html是这样有用吗? – adaam 2013-04-08 19:08:46