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
Post a Comment