objective c - Filter arrays with predicate -



objective c - Filter arrays with predicate -

i want filter 2 lists. i'm having list contains many items , list b contains items want track. list must filtered list b.

i tried this:

nsarray * trackings = [[beacondao sharedinstance] loaddata]; nspredicate *filter = [nspredicate predicatewithformat:@"macaddress in %@", trackings]; nsarray *filteredobjects = [list filteredarrayusingpredicate:filter]; nslog(@"filteredobject count = %d", [filteredobjects count]);

where trackings nsarray custom model wrote property macaddress. filteredobjects 0 wrong.

can help me out?

from description (seeing log of array contents useful) supplying objects match against instead of contained mac addresses. instead, do:

nspredicate *filter = [nspredicate predicatewithformat:@"macaddress in %@", [trackings valueforkey:@"macaddress"]];

so filtering against addresses (cutting out container objects).

objective-c nspredicate

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -