Magical Record - 设置时崩溃
Posted
技术标签:
【中文标题】Magical Record - 设置时崩溃【英文标题】:Magical Record - Crash when setting up 【发布时间】:2014-12-06 04:07:40 【问题描述】:我在许多其他项目中安装了 MR。出于某种原因,这次我在 didFinishLaunchingWithOptions 的这条线上遇到了崩溃:
[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:@"DB.sqlite"];
这是崩溃:
[NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:]: unrecognized selector sent to class 0xc54ca4
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:]: unrecognized selector sent to class 0xc54ca4'
*** First throw call stack:
(
0 CoreFoundation 0x017a7946 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x01430a97 objc_exception_throw + 44
2 CoreFoundation 0x017af465 +[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x016f83e7 ___forwarding___ + 1047
4 CoreFoundation 0x016f7fae _CF_forwarding_prep_0 + 14
5 MyApp 0x00107f20 +[MagicalRecord(Setup) setupCoreDataStackWithAutoMigratingSqliteStoreNamed:] + 256
6 MyApp 0x00093d7a -[MyAppDelegate application:didFinishLaunchingWithOptions:] + 186
7 UIKit 0x028e697c -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 291
8 UIKit 0x028e7687 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2869
9 UIKit 0x028eac0d -[UIApplication _runWithMainScene:transitionContext:completion:] + 1639
10 UIKit 0x029037d0 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
11 UIKit 0x028e981f -[UIApplication workspaceDidEndTransaction:] + 155
12 FrontBoardServices 0x059499de __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
13 FrontBoardServices 0x0594946f __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
14 FrontBoardServices 0x0595b425 __31-[FBSSerialQueue performAsync:]_block_invoke + 26
15 CoreFoundation 0x016cb1c0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
16 CoreFoundation 0x016c0ad3 __CFRunLoopDoBlocks + 195
17 CoreFoundation 0x016c092b __CFRunLoopRun + 2715
18 CoreFoundation 0x016bfbcb CFRunLoopRunSpecific + 443
19 CoreFoundation 0x016bf9fb CFRunLoopRunInMode + 123
20 UIKit 0x028e91e4 -[UIApplication _run] + 571
21 UIKit 0x028ec8b6 UIApplicationMain + 1526
22 MyApp 0x0015715d main + 141
23 libdyld.dylib 0x04306ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
可能是什么原因?
【问题讨论】:
你添加了coreData框架吗? 是的。存在 CoreData 框架。 【参考方案1】:我最终重新导入了所有 MR 文件,问题得到了解决...
【讨论】:
【参考方案2】:尝试将值“-ObjC”添加到“其他链接器标志”
【讨论】:
以上是关于Magical Record - 设置时崩溃的主要内容,如果未能解决你的问题,请参考以下文章
设置一对多关系 Core Data 和 Magical Record
尝试将 Magical Record 与 Kiwi 一起使用时构建测试时出错
Magical Record 似乎可以保存,但如果应用程序终止,更改会丢失
AFNetworking 的 Magical Record 导入问题