ios - iphone: [NSNull getCharacters:]: unrecognized selector error using NSPredicate -
hi when try search entity in core data on fields, following error:
[nsnull getcharacters:]: unrecognized selector sent instance
this code using set predicate:
- (void)filtercontentforsearchtext:(nsstring*)searchtext scope:(nsstring*)scope { nspredicate *resultpredicate =[nspredicate predicatewithformat:@"jobtitle=%@",@"barber"]; searchresults = [getcontacts filteredarrayusingpredicate:resultpredicate]; }
however, when set predicate know true on other fields, search works correctly:
- (void)filtercontentforsearchtext:(nsstring*)searchtext scope:(nsstring*)scope { nspredicate *resultpredicate =[nspredicate predicatewithformat:@"title=%@",@"dr"]; searchresults = [getcontacts filteredarrayusingpredicate:resultpredicate]; }
first version searches on title field/attribute, second on jobtitle field/attribute.
examining attributes job , jobtitle in model, cannot discern difference between them.
can tell me nsnull coming , means? there missing in properties of attributes account this?
thanks in advance suggestions.
looks objects in getcontacts
array don't have jobtitle
property in first method. can check printing first object nslog(@"%@", getcontacts.firstobject)
or print whole array nslog(@"%@", getcontacts)
Comments
Post a Comment