0
在地址簿類應用程序上做項目。我需要預測地址簿聯繫人,結果如下所示預測嵌套陣列
(
{
AddressKey = (
);
Email = (
);
"JobTitle_Name" = "";
"Organisation_Name" = "";
Phone = (
{
phoneNumber = "+919502266633";
"phone_type" = home;
},
{
phoneNumber = 9703570333;
"phone_type" = work;
},
{
phoneNumber = 91234512345;
"phone_type" = iPhone;
},
{
phoneNumber = 91239123;
"phone_type" = mobile;
}
);
"first_name" = Raviraja;
imageKey = "";
"last_name" = "";
serialNumberKey = 53;
source = Device;
}
)
需要使用phoneNumber鍵來判斷數組。我試過這一個
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY %K == %@",@"phoneNumber",[NSString stringWithFormat:@"%@",str]];
NSArray *array = [contactsArray filteredArrayUsingPredicate:predicate];
但不工作eventhough電話號碼匹配。
幫幫我吧。
注意您可以替換'[的NSString stringWithFormat:@ 「%@」,STR]'只需'str'。 –