NSPredicate - filtering values based on a BOOLEAN stored value

后端 未结 8 1164
终归单人心
终归单人心 2021-02-03 19:55

I have a core data model object called Entry. In this I have an attribute IsFavorite.

I would like to use an NSPredicate to filter the results of my NSFetchedResultsCont

8条回答
  •  青春惊慌失措
    2021-02-03 20:39

    swift 3 version worked great for me:

     let predicate = NSPredicate(format: "isFriend == %@" ,NSNumber(booleanLiteral: false))
    

    following @scipilot answer the bool shouldn't be an optional. thanks for that!

提交回复
热议问题