使用谓词在数组中搜索字典

avf*_*dlf 3 arrays iphone predicate nsdictionary ios

我有一系列字典,我想找到具有键"guid"所需值的字典.无法使用此代码获取:

NSPredicate *filter = [NSPredicate predicateWithFormat:@"guid = %@", key];
NSArray *filteredContacts = [selectedValue filteredArrayUsingPredicate:filter];
Run Code Online (Sandbox Code Playgroud)

小智 5

试试这个.

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"Name CONTAINS[cd] %@",searchBar.text];

filterdArray = [[hospitalArray filteredArrayUsingPredicate:predicate] mutableCopy];
Run Code Online (Sandbox Code Playgroud)

Name数组下的字典中包含的键在哪里.