我有核心數據實體人員和邊界。他們有多對多的關係(每個人可以有很多邊界,每個邊界可以有很多人)。NSPredicate with a!=?
我想創建一個界限人物弗雷德沒有關係的列表。
Person *person = [Person MR_findFirstByAttribute:@"name" withValue:@"Fred"];
DLog(@"person.boundaries.count: %d", person.boundaries.count);
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY persons != %@", person];
DLog(@"testBoundaries.count: %d", [Boundary MR_countOfEntitiesWithPredicate:predicate]);
我在數據庫中有47個邊界和Fred可以看到所有47.因此,我希望我的獲取返回0:
DEBUG | -[LoginViewController viewDidLoad] | person.boundaries.count: 47
DEBUG | -[LoginViewController viewDidLoad] | testBoundaries.count: 47
什麼是錯我的斷言?
其實我並沒有測試是否錯誤已被固定在搭載iOS 7,因此「沒有什麼」可能是值得一試... –
這做到了!子查詢工作。再次感謝馬丁!男人,我希望在你幫助我的所有時候,我都可以爲你買一瓶啤酒。 – Padin215
不,任何'NOT ANY'都會因某種奇怪的原因返回46個邊界。 – Padin215