在开始之前,让我告诉你我的数据模型是什么样的:
然后我有一个带有以下谓词的获取请求:
NSArray *allowedPackNames = @[@"success, happiness, free"];
self.fetchedResultsController = [Author MR_fetchAllGroupedBy:nil
withPredicate:[NSPredicate predicateWithFormat:@"ANY quotes.quote.pack.packName IN %@", allowedPackNames]
sortedBy:AuthorKeys.name
ascending:YES
delegate:self];
我想获取所有包含成功或幸福或免费包名称的作者。 如下面的关系表中所示,作者有一组NSB引号。但是,当我执行此操作时,我收到以下错误:
CoreData: error: (1) I/O error for database at /Users/Abdul/Library/Application Support/iPhone Simulator/6.1/Applications/DA17421B-A54D-42E3-9694-FDCBFF7F8BA4/Library/Application Support/MyCoolApp/MyCoolApp.sqlite. SQLite error code:1, 'no such column: t2.ZQUOTE'
2013-04-05 15:26:47.175 MyCoolApp[78622:c07] Core Data: annotation: -executeRequest: encountered exception = I/O error for database at /Users/Aditya/Library/Application Support/iPhone Simulator/6.1/Applications/DA17421B-A54D-42E3-9694-FDCBFF7F8BA4/Library/Application Support/MyCoolApp/MyCoolApp.sqlite. SQLite error code:1, 'no such column: t2.ZQUOTE' with userInfo = {
NSFilePath = "/Users/Abdul/Library/Application Support/iPhone Simulator/6.1/Applications/DA17421B-A54D-42E3-9694-FDCBFF7F8BA4/Library/Application Support/MyCoolApp/MyCoolApp.sqlite";
NSSQLiteErrorDomain = 1;
}
知道为什么吗?
答案 0 :(得分:1)
如果我看得正确,谓词应为
[NSPredicate predicateWithFormat:@"ANY quotes.pack.packName IN %@", allowedPackNames]
即。你必须删除"引用",这是 Quote 实体的属性,而不是关系。