iOS CoreData NSPredicate to query multiple properties at once

后端 未结 8 1825
刺人心
刺人心 2020-12-23 22:39

I am trying to use a UISearchBar to query multiple properties of a NSManagedObject I have a NSManagedObject called Person

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-23 22:45

    To avoid the warning Incompatible pointer types initializing 'NSCompoundPredicate *_strong' with an expression of type 'NSPredicate *', replace the following:

    NSCompoundPredicate * predicate = [NSCompoundPredicate orPredicateWithSubPredicates:subPredicates];
    

    with this:

    NSPredicate * predicate = [NSCompoundPredicate orPredicateWithSubpredicates:subPredicates];
    

    Source: NSCompoundPredicate

提交回复
热议问题