我有一个NSMutableArray
(NSMutableDictionary
它是一个 plist)。数组中的每个字典都有 2 个键:' id
' 和 ' lu
'。
如何在 where 中找到索引NSMutableArray
,NSMutableDictionary
例如id
= '47653'?
我试图这样做,但它不工作:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
NSString *path = [basePath stringByAppendingPathComponent:@"id.plist"];
NSMutableArray *mut_array = [[NSArray arrayWithContentsOfFile:path] mutableCopy];
NSMutableDictionary *mut_dico = [[NSMutableDictionary alloc] init];
NSString *egalIDPlistData = [contentDictio objectForKey:@"id"];
for(mut_dico in mut_array) {
if([[mut_dico objectForKey:@"id"] isEqualToString:@"47653"]) {
NSLog(@"Test");
}
}