adi*_*dit 0 iphone core-data objective-c ipad ios
我有以下NSPredicate:
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"url = %@ AND type = %@ OR type = %@", newsStory.url, [NSNumber numberWithInt:StoryHighlighted], [NSNumber numberWithInt:StorySavedAndHighlighted]];
Run Code Online (Sandbox Code Playgroud)
我想用这个特定的URL和类型(突出显示或突出显示并保存)来获取故事.但是上面的查询似乎不起作用.我究竟做错了什么?
就像将OR包装在括号中以避免混淆一样简单?
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"url = %@ AND (type = %@ OR type = %@)", newsStory.url, [NSNumber numberWithInt:StoryHighlighted], [NSNumber numberWithInt:StorySavedAndHighlighted]];
Run Code Online (Sandbox Code Playgroud)