魔法记录 - 设置时崩溃

时间:2014-12-06 04:07:41

标签: ios core-data nsmanagedobjectcontext magicalrecord

我已在许多其他项目中安装了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

可能是什么原因?

2 个答案:

答案 0 :(得分:0)

我最终重新导入了所有MR文件,问题得到解决......

答案 1 :(得分:0)

尝试添加“Other Linker Flags”值“-ObjC”