【发布时间】:2011-01-17 19:24:45
【问题描述】:
我需要在我的 iPhone 应用中搜索核心数据实体。
在我的核心数据中,我有一个实体“myEntity”,它有两个属性“stringOne”和“stringTwo”;都定义为 NSString。
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"stringOne contains[cd] %@", self.keyword4Search];
[fetchRequest setPredicate:predicate];
我上面的代码仅在 stringOne 中搜索包含 keyword4Search 的实体。
我需要的是在[stringOne OR stringTwo]中搜索包含keyword4Search的实体。
我希望有种
predicateWithFormat:@"stringOne or stringTwo contains[cd] %@", self.keyword4Search];
我应该去哪里看?
【问题讨论】:
标签: iphone core-data predicate