【问题标题】:Core data doesn't work in iOS 4.3核心数据在 iOS 4.3 中不起作用
【发布时间】:2012-05-08 15:22:17
【问题描述】:

我的核心数据有问题。它可以在 iOS 5.0 和更高版本中运行,但是当我在 iOS 4.3 中运行它时它崩溃了,它就在线上崩溃了 __managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType]; 有人可以帮助我吗?

2012-05-08 17:01:21.617 [7489:10e03] -[NSManagedObjectContext initWithConcurrencyType:]: unrecognized selector sent to instance 0x4ddc6c0
2012-05-08 17:01:21.650 [7489:10e03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObjectContext initWithConcurrencyType:]: unrecognized selector sent to instance 0x4ddc6c0'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x0111e5a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x0153c313 objc_exception_throw + 44
    2   CoreFoundation                      0x011200bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x0108f966 ___forwarding___ + 966
    4   CoreFoundation                      0x0108f522 _CF_forwarding_prep_0 + 50
    5   0x00002a42 -[AppDelegate managedObjectContext] + 194
    6   0x00003736 -[HomeViewController fetchFeedDataIntoDocument] + 134
    7   Amsterdam                   0x0000417d -[HomeViewController refresh] + 45
    8   Amsterdam                   0x0000803f -[MBProgressHUD launchExecution] + 143
    9   Foundation                          0x00ae2cf4 -[NSThread main] + 81
    10  Foundation                          0x00ae2c80 __NSThread__main__ + 1387
    11  libsystem_c.dylib                   0x93393ed9 _pthread_start + 335
    12  libsystem_c.dylib                   0x933976de thread_start + 34
)
terminate called throwing an exception(lldb) 

【问题讨论】:

    标签: ios core-data nsmanagedobjectcontext ios4 nspersistentstore


    【解决方案1】:

    initWithConcurrencyType:NSMainQueueConcurrencyType 是新的 5.0

    http://developer.apple.com/library/ios/#releasenotes/General/iOS50APIDiff/index.html

    您需要在使用前检查版本。

    您需要检查版本并使用 init 代替早期版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-08
      • 1970-01-01
      • 2011-02-19
      • 1970-01-01
      • 2014-09-12
      • 1970-01-01
      • 2016-01-23
      • 1970-01-01
      相关资源
      最近更新 更多