objective c - Predicating Nested Array -


doing project on addressbook kind of app. need predicate address book contacts, result looks this

( { 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; } ) 

need predicate array using phonenumber key. tried one

        nspredicate *predicate = [nspredicate predicatewithformat:@"any %k == %@",@"phonenumber",[nsstring stringwithformat:@"%@",str]];         nsarray *array = [contactsarray filteredarrayusingpredicate:predicate]; 

but not working eventhough phone number matching.

help me out guys.

the key path wrong, should be

[nspredicate predicatewithformat:@"any %k == %@",@"phone.phonenumber", ...] 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -