Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSArray *anArray = @[ @{@"identifier1": @{ @"3498239502323120": @{@"key1":@"abc",
- @"key2": @123},
- @"3493208429034821": @{ @"key1": @"def",
- @"key2": @456}
- },
- @"identifier2": @{ @"456434234234": @{ @"key1": @"ghi",
- @"key2": @789 },
- @"8796554": @{ @"key1": @"jkl",
- @"key2": @101112 }
- }
- }];
- NSArray *identifier1 = [anArray valueForKeyPath:@"identifier1"];
- NSLog(@"identifier1: %@", identifier1);
- NSMutableArray *values = [[NSMutableArray alloc] init];
- for (NSDictionary *aDict in identifier1)
- {
- NSArray *subdictionaries = [aDict allValues];
- [values addObjectsFromArray:[subdictionaries valueForKey:@"key1"]];
- for (NSDictionary *aSubdict in subdictionaries) {
- // OR
- // NSString *aValue = aSubdict[@"key1"];
- // if (aValue)
- // {
- // [values addObject:aValue];
- // }
- }
- }
- NSLog(@"Values: %@", values);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement