直升機傢伙,核心 - 數據NSPredicate多到多的條件
,我有以下核心數據的數據庫:
(!可惜我不能嵌入圖像,因爲垃圾郵件預防)
數據庫模型圖片:http://snapplr.com/eqx9
我想創建一個fetchRequest,其獲取所有FC對象,其fcCollection.fcSets.trainingSet
屬性是在我的代碼的對象,但不是在trainingSet.memorizationSession.mistakeFCs
。我想在NSFetchedResultsController
中使用它。
我已經嘗試了這麼多不同的東西,他們都沒有工作(可惜我沒有保存我試過的東西,所以我不能發佈)。 但我嘗試過SUBQUERIES等。我最後的辦法是:
NSFetchRequest *fetchRequest = [[[NSFetchRequest alloc] init] autorelease];
NSEntityDescription *entity = [NSEntityDescription entityForName: kFCMistakeEntityName
inManagedObjectContext: self.managedObjectContext];
[fetchRequest setEntity: entity];
NSPredicate *subPredicate = [NSPredicate predicateWithFormat:
@"memorizationSession.trainingSet == %@", _trainingSet];
[fetchRequest setPredicate: subPredicate];
NSArray *mistakeFCs = [self.managedObjectContext executeFetchRequest:fetchRequest error: nil];
predicate = [NSPredicate predicateWithFormat:
@"ANY fcCollection.fcSets.trainingSet == %@ && NOT mistakeFC in %@", _trainingSet, mistakeFCs];
不幸的是我收到此錯誤:
2011-05-18 22:26:55.643 testApp[9464:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'unimplemented SQL generation for predicate : (mistakeFC IN {FCMistake: empty FC; correctFC: 0, FCMistake: 55; correctFC: 9, FCMistake: empty FC; correctFC: 3, FCMistake: empty FC; correctFC: 9, FCMistake: empty FC; correctFC: 4})'
這必須有可能以某種方式!預先感謝您的幫助!
問候,金