我有一个NSArray
并NSDictionary
尝试使用以下代码删除重复项:
NSDictionary *arnold = @{@"name" : @"arnold", @"state" : @"california"};
NSDictionary *jimmy = @{@"name" : @"jimmy", @"state" : @"new york"};
NSDictionary *henry = @{@"name" : @"henry", @"state" : @"michigan"};
NSDictionary *woz = @{@"name" : @"woz", @"state" : @"california"};
NSArray *people = @[arnold, jimmy, henry, woz];
NSMutableArray *results=[[NSMutableArray alloc]initWithArray: [people valueForKeyPath:@"@distinctUnionOfObjects.state"]];
NSLog(@"results %@", results);
这是我从 nslog 得到的输出:
results (
california,
michigan,
"new york"
)
我的问题是如何将完整目录添加到数组中?