objective c - NSPredicate Crashes when trying to use CONTAINS -
the data structure want question. data
transformable
field in turn nsdictionary
.
obj = { //... nsdictionary *data:@{ likespeople:@[@{@"username":@"jack",@"id":@"ae3132"}] } }
what want search inside nsarray *fetchresult
check there noone in likespeople
x id
. attempts on doing end crashing highlighting there problem in nspredicate
declaration.
what doing wrong , how fetch information want?
socialwall *thesocialwall = fetchresult[0]; nslog(@"%@",thesocialwall.data); nspredicate * predicate = [nspredicate predicatewithformat:@"data.likespeople contains(c) %@",myuser.userwebid]; nsarray * result = [fetchresult filteredarrayusingpredicate:predicate]; nslog(@"%@",result);
not contains(c) contains[c]
#import <foundation/foundation.h> int main(int argc, char *argv[]) { @autoreleasepool { nsdictionary *d = @{@"key":@"hi name dominik pich"}; nsarray *a = @[d]; nspredicate * predicate = [nspredicate predicatewithformat:@"key contains[c] %@",@"dominik"]; nsarray * result = [a filteredarrayusingpredicate:predicate]; nslog(@"%@",result); } }
Comments
Post a Comment