Core data 根据死简单提取请求调用“\u Unwind\u Resume”
我正在尝试将一些核心数据代码从测试Mac OS应用程序移植到iPhone应用程序。我设置了一个helper方法来管理抓取的所有代码,在Mac OS上一切都很好,但我在iPhone上遇到了这个错误:Core data 根据死简单提取请求调用“\u Unwind\u Resume”,core-data,ios4,Core Data,Ios4,我正在尝试将一些核心数据代码从测试Mac OS应用程序移植到iPhone应用程序。我设置了一个helper方法来管理抓取的所有代码,在Mac OS上一切都很好,但我在iPhone上遇到了这个错误: Detected an attempt to call a symbol in system libraries that is not present on the iPhone: _Unwind_Resume called from function -[NSSQLAdapter _newSele
Detected an attempt to call a symbol in system libraries that is not present on the iPhone:
_Unwind_Resume called from function -[NSSQLAdapter _newSelectStatementWithFetchRequest:ignoreInheritance:] in image CoreData.
以下是调用helper方法的代码:
// get authors and title THIS WORKS
NSArray *bookInfoFetchResults = [self getEntitiesByName:kOC_CD_ObjectKey_bookInfo
usingPredicateValue:@"contentRoot.bookInfo.bookAuthors > \"\""
withSubstitutionVariables:[NSDictionary dictionaryWithObjectsAndKeys:nil]
inModel:model
andContext:context
sortByAttribute:nil];
int thisResult = 0;
int lastResult = [bookInfoFetchResults count];
for (thisResult = 0; thisResult < lastResult; thisResult++) {
NSManagedObject *currentResult = [bookInfoFetchResults objectAtIndex:thisResult];
NSLog(@"bookAuthors: %@", [currentResult valueForKey:kOC_CD_ObjectAttribute_bookAuthors]);
NSLog(@"bookTitle: %@", [currentResult valueForKey:kOC_CD_ObjectAttribute_bookTitle]);
}
// get chapters THIS DOES NOT WORK
NSArray *chapterFetchResults = [self getEntitiesByName:kOC_CD_ObjectKey_chapter
usingPredicateValue:@"ALL contentRoot.chapters.title > \"\""
withSubstitutionVariables:[NSDictionary dictionaryWithObjectsAndKeys:nil]
inModel:model
andContext:context
sortByAttribute:kOC_CD_ObjectAttribute_key];
int thisChapterResult = 0;
int lastChapterResult = [chapterFetchResults count];
for (thisChapterResult = 0; thisChapterResult < lastChapterResult; thisChapterResult++) {
NSManagedObject *currentChapterResult = [chapterFetchResults objectAtIndex:thisChapterResult];
NSLog(@"Chapter %@: %@", [currentChapterResult valueForKey:kOC_CD_ObjectAttribute_number], [currentChapterResult valueForKey:kOC_CD_ObjectAttribute_title]);
}
辅助方法中的故障点是:
fetchResults = [aContext executeFetchRequest:fetchRequestToExecute error:&fetchError];
从helper方法中分离代码也不起作用
我不知道这是否有帮助,但在剥离了我的helper方法中的错误处理代码后,我得到了以下结果:
2010-11-30 16:31:30.633 OC Flash Card Core 2[19306:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported predicate (null)'
*** Call stack at first throw:
(
0 CoreFoundation 0x02655b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x027a540e objc_exception_throw + 47
2 CoreData 0x02381e86 -[NSSQLGenerator generateSQLStatementForFetchRequest:ignoreInheritance:countOnly:] + 1254
3 CoreData 0x023816f0 -[NSSQLAdapter _newSelectStatementWithFetchRequest:ignoreInheritance:] + 480
4 CoreData 0x02381501 -[NSSQLAdapter newSelectStatementWithFetchRequest:] + 49
5 CoreData 0x023813ae -[NSSQLCore newRowsForFetchPlan:] + 430
6 CoreData 0x02380b09 -[NSSQLCore objectsForFetchRequest:inContext:] + 297
7 CoreData 0x023806fe -[NSSQLCore executeRequest:withContext:error:] + 206
8 CoreData 0x0242e91c -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1084
9 CoreData 0x0237d897 -[NSManagedObjectContext executeFetchRequest:error:] + 359
10 OC Flash Card Core 2 0x0000360e -[OCContentImporterObj getEntitiesByName:usingPredicateValue:withSubstitutionVariables:inModel:andContext:sortByAttribute:] + 481
11 OC Flash Card Core 2 0x00002af7 -[OCContentImporterObj testCoreDataIntegrity] + 188
12 OC Flash Card Core 2 0x00002864 -[OCContentImporterObj importContent] + 88
13 OC Flash Card Core 2 0x0000252b -[AppDelegate_iPhone application:didFinishLaunchingWithOptions:] + 91
14 UIKit 0x002b4f27 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
15 UIKit 0x002b73b0 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 346
16 UIKit 0x002c13ec -[UIApplication handleEvent:withNewEvent:] + 1958
17 UIKit 0x002b9b3c -[UIApplication sendEvent:] + 71
18 UIKit 0x002be9bf _UIApplicationHandleEvent + 7672
19 GraphicsServices 0x02f35822 PurpleEventCallback + 1550
20 CoreFoundation 0x02636ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
21 CoreFoundation 0x02597807 __CFRunLoopDoSource1 + 215
22 CoreFoundation 0x02594a93 __CFRunLoopRun + 979
23 CoreFoundation 0x02594350 CFRunLoopRunSpecific + 208
24 CoreFoundation 0x02594271 CFRunLoopRunInMode + 97
25 UIKit 0x002b6c6d -[UIApplication _run] + 625
26 UIKit 0x002c2af2 UIApplicationMain + 1160
27 OC Flash Card Core 2 0x00001ce0 main + 102
28 OC Flash Card Core 2 0x00001c71 start + 53
)
terminate called after throwing an instance of 'NSException'
但是,再一次,所有这些在Mac操作系统中都完美无瑕。我尝试过搜索“放松”简历,但这似乎是苹果的一个缺陷,至少有十几种不同的方法可以找到它,还有十几种不同的方法可以解决它。我能想到的唯一区别是,一次尝试只在CD存储中有一个实例,而第二次,麻烦的一次,可能有很多。有什么想法吗?找到了解决方法:在用于搜索的谓词中,ALL关键字必须是Any
我不明白的是为什么会这样。给出的错误似乎相当模糊,并且它最终导致EXC_BAD_访问的事实非常令人不安。我愿意接受任何人的答案,只要他们能解释为什么“任意”和“所有”之间存在如此大的差异。如果不查看数据模型和谓词,就无法确定答案,但“所有”和“任意”都是不同的测试。ALL返回true是指每个已计算属性的计算结果都为true。如果一个或多个计算属性的值为true,则返回true。一个常见的错误是试图使用ALL来跨越多个关系。如果您想知道问题失败的原因,您可能需要发布一个带有实体映射和谓词的新问题。
2010-11-30 16:31:30.633 OC Flash Card Core 2[19306:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported predicate (null)'
*** Call stack at first throw:
(
0 CoreFoundation 0x02655b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x027a540e objc_exception_throw + 47
2 CoreData 0x02381e86 -[NSSQLGenerator generateSQLStatementForFetchRequest:ignoreInheritance:countOnly:] + 1254
3 CoreData 0x023816f0 -[NSSQLAdapter _newSelectStatementWithFetchRequest:ignoreInheritance:] + 480
4 CoreData 0x02381501 -[NSSQLAdapter newSelectStatementWithFetchRequest:] + 49
5 CoreData 0x023813ae -[NSSQLCore newRowsForFetchPlan:] + 430
6 CoreData 0x02380b09 -[NSSQLCore objectsForFetchRequest:inContext:] + 297
7 CoreData 0x023806fe -[NSSQLCore executeRequest:withContext:error:] + 206
8 CoreData 0x0242e91c -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1084
9 CoreData 0x0237d897 -[NSManagedObjectContext executeFetchRequest:error:] + 359
10 OC Flash Card Core 2 0x0000360e -[OCContentImporterObj getEntitiesByName:usingPredicateValue:withSubstitutionVariables:inModel:andContext:sortByAttribute:] + 481
11 OC Flash Card Core 2 0x00002af7 -[OCContentImporterObj testCoreDataIntegrity] + 188
12 OC Flash Card Core 2 0x00002864 -[OCContentImporterObj importContent] + 88
13 OC Flash Card Core 2 0x0000252b -[AppDelegate_iPhone application:didFinishLaunchingWithOptions:] + 91
14 UIKit 0x002b4f27 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
15 UIKit 0x002b73b0 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 346
16 UIKit 0x002c13ec -[UIApplication handleEvent:withNewEvent:] + 1958
17 UIKit 0x002b9b3c -[UIApplication sendEvent:] + 71
18 UIKit 0x002be9bf _UIApplicationHandleEvent + 7672
19 GraphicsServices 0x02f35822 PurpleEventCallback + 1550
20 CoreFoundation 0x02636ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
21 CoreFoundation 0x02597807 __CFRunLoopDoSource1 + 215
22 CoreFoundation 0x02594a93 __CFRunLoopRun + 979
23 CoreFoundation 0x02594350 CFRunLoopRunSpecific + 208
24 CoreFoundation 0x02594271 CFRunLoopRunInMode + 97
25 UIKit 0x002b6c6d -[UIApplication _run] + 625
26 UIKit 0x002c2af2 UIApplicationMain + 1160
27 OC Flash Card Core 2 0x00001ce0 main + 102
28 OC Flash Card Core 2 0x00001c71 start + 53
)
terminate called after throwing an instance of 'NSException'