2 つのモデル クラス
AUser
- name
AGroup
- users
グループとユーザーは、多対多の関係を共有します。
2 つのセットがまったく同じユーザーを共有しているかどうか (ユーザーが多いか少ないかではなく) を確認したい
しかし残念ながら、次のエラーが表示されます: to-many key not allowed here
私は他のSOの質問を見てきましたが、過去2時間彼らの方法論を使用しようとしたため、どれも当てはまらなかったことに注意してください。または、少なくとも私はそれらをよく理解していませんでした。
また、2 つの変更可能なセットを比較するための述語は大丈夫ですか?
- (BOOL)conversationExists:(NSMutableSet *)members {
NSFetchRequest *request= [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"AGroup" inManagedObjectContext:_managedObjectContext];
NSPredicate *predicate =[NSPredicate predicateWithFormat:@"users==%@",members];
//There is more code that I have not shown here as it is irrelevant to the question
//Mainly The NSPredicate line is the problem
}
お時間をいただきありがとうございました。ほんとうにありがとう。
から、 新しい iOS プログラマー