Core Data和iCloud出错

时间:2015-05-19 09:32:12

标签: ios core-data

我正在尝试使用Core Data和iCloud。 它工作过一次,但没有再次发生。

我在下面遇到了这个错误:

2015-05-19 12:11:13.695 Student Notebook App[34617:992535] -[Student_Notebook_App.NotebookTableView persistentStoreWillChange]: unrecognized selector sent to instance 0x7f86495514b0
2015-05-19 12:11:13.737 Student Notebook App[34617:992535] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Student_Notebook_App.NotebookTableView persistentStoreWillChange]: unrecognized selector sent to instance 0x7f86495514b0'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000110638c65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010ff15bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x00000001106400ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x000000011059613c ___forwarding___ + 988
    4   CoreFoundation                      0x0000000110595cd8 _CF_forwarding_prep_0 + 120
    5   CoreFoundation                      0x000000011060854c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
    6   CoreFoundation                      0x0000000110506a04 _CFXNotificationPost + 2484
    7   Foundation                          0x000000010fa6c968 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
    8   CoreData                            0x0000000110303d5b __81-[PFUbiquitySetupAssistant tryToReplaceLocalStore:withStoreSideLoadedByImporter:]_block_invoke + 283
    9   libdispatch.dylib                   0x00000001131f5614 _dispatch_client_callout + 8
    10  libdispatch.dylib                   0x00000001131e02fa _dispatch_barrier_sync_f_slow_invoke + 275
    11  libdispatch.dylib                   0x00000001131f5614 _dispatch_client_callout + 8
    12  libdispatch.dylib                   0x00000001131dda1c _dispatch_main_queue_callback_4CF + 1664
    13  CoreFoundation                      0x00000001105a01f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    14  CoreFoundation                      0x0000000110561dcb __CFRunLoopRun + 2043
    15  CoreFoundation                      0x0000000110561366 CFRunLoopRunSpecific + 470
    16  GraphicsServices                    0x0000000114e91a3e GSEventRunModal + 161
    17  UIKit                               0x0000000110c73900 UIApplicationMain + 1282
    18  Student Notebook App                0x000000010f923aa7 main + 135
    19  libdyld.dylib                       0x0000000113229145 start + 1
    20  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

拜托,任何人都可以帮助我吗?

先谢谢

1 个答案:

答案 0 :(得分:0)

错误很明显:

-[Student_Notebook_App.NotebookTableView persistentStoreWillChange]: unrecognized selector sent to instance 0x7f86495514b0

这表示您的代码正在尝试在没有该方法的类上调用名为persistentStoreWillChange的方法。

堆栈跟踪表明发布通知时发生了这种情况。它没有说出哪一个。发生的事情是:

  • 您注册后使用名为persistentStoreWillChange
  • 的方法观察通知
  • 后来发布了通知。通知系统尝试调用persistentStoreWillChange,但该方法不存在。

注册通知时,您提供的回调方法名称必须存在。