核心数据:来自performBlockAndWait块的executeFetchRequest会导致崩溃

时间:2017-05-30 08:29:43

标签: ios objective-c multithreading core-data automatic-ref-counting

我正在使用performBlockAndWait创建的managedObjectContext上使用NSPrivateQueueConcurrancyType来电。在这个电话中,我做executeFetchRequest,这就是造成崩溃。我认为这与核心数据multithreading有关。

  - (void)getAllModelObjectsKindOfMethod {

     [context performBlockAndWait:^{

         // prepares the fetchRequest 

         fetchedRecords = [context executeFetchRequest:fetchRequest error:&fetchRequestError];

        // processes the fetched objects 

     }];

     [context reset];

   }

这是从crashlytics

收到的崩溃日志

12。崩溃:com.apple.root.default-qos

  

0 libobjc.A.dylib 0x187bd41a0 objc_retain + 16
1   libobjc.A.dylib 0x187bd4218 objc_storeStrong + 44
  2版本0x1005dcfe0 - [MyManager   getAllModelObjectsKindOfMethod](MyManager.m:1214)
3   ---------------
4 ---调用堆栈到MyManager类

9。 NSManagedObjectContext 0x1747ce4c0

  

0 libsystem_kernel.dylib 0x1881518e8 __ulock_wait + 8
1   libdispatch.dylib 0x18802177c _dispatch_ulock_wait +   48
2 libdispatch.dylib 0x1880218a4   _dispatch_thread_event_wait_slow + 36
3 libdispatch.dylib 0x18801f4f0 _dispatch_barrier_sync_f_slow + 236 4 CoreData
  0x18b4cd03c _perform + 232
5 CoreData
  0x18b4dd8b8 - [NSManagedObjectContext(_NestedContextSupport)   executeRequest:withContext:error:] + 176
6 CoreData
  0x18b42d5e0 - [NSManagedObjectContext executeFetchRequest:error:] +   580
7实时无店铺0x10057cfac   __169 + [MyManager getAllModelObjectsKindOfMethod] _block_invoke(MyManager.m:1294)
8 CoreData 0x18b4d2214   developerSubmittedBlockToNSManagedObjectContextPerform + 152
9   libdispatch.dylib 0x18800e9a0 _dispatch_client_callout +   16
10 libdispatch.dylib 0x18801bee0   _dispatch_barrier_sync_f_invoke + 84
11 CoreData 0x18b4d211c - [NSManagedObjectContext performBlockAndWait:] + 304
  12 ......来自项目内部班级的调用栈

我也收到了来自crashlytics的暗示。

Crashlytics Hint regarding the crash

0 个答案:

没有答案