获取错误时的CoreData崩溃:NSProcessingInternalChange

时间:2015-06-05 05:32:51

标签: ios core-data

在我的应用程序中,我将数据保存到主线程\队列中的coredata,并在保存后立即获取所有记录以确保我没有超过本地存储的大小。

所有都在主线程上同步发生。

我随机崩溃了:

  

[NSManagedObjectContext(_NSInternalChangeProcessing)_processRecentChanges:] + 2284

核心数据具有索引属性,我想知道在保存返回后是否发生索引生成,并且在索引期间fetch捕获数据库并且失败了吗?

另外我看到另一个帖子NSPersistentStoreCoordinator

这是什么意思?我专门发送coredata操作在主线程中执行。 coredata会在内部将其发送到另一个线程吗?

这可能导致车祸?非常感谢任何帮助!

堆栈跟踪如下所示:

Thread : Crashed: com.apple.main-thread
0  CoreFoundation                 0x000000018214602c __CFBasicHashDrain + 196
1  CoreFoundation                 0x0000000182145f9c __CFBasicHashDrain + 52
2  CoreData                       0x0000000181de28c8 -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 2284
3  CoreData                       0x0000000181ddadc4 _performRunLoopAction + 384
4  CoreFoundation                 0x00000001820cc2a4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
5  CoreFoundation                 0x00000001820c9230 __CFRunLoopDoObservers + 360
6  CoreFoundation                 0x00000001820c9610 __CFRunLoopRun + 836
7  CoreFoundation                 0x0000000181ff52d4 CFRunLoopRunSpecific + 396
8  GraphicsServices               0x000000018b80b6fc GSEventRunModal + 168
9  UIKit                          0x0000000186bbafac UIApplicationMain + 1488
10 MyApp                     0x000000010002ba88 main (main.m:16)
11 libdyld.dylib                  0x0000000193fb6a08 start + 4

Thread : NSPersistentStoreCoordinator 0x170666900
0  libsystem_platform.dylib       0x00000001941616a4 OSAtomicCompareAndSwap64Barrier + 12
1  libsystem_pthread.dylib        0x0000000194169428 _pthread_mutex_lock + 312
2  libsqlite3.dylib               0x0000000193c89d0c (null) + 20676
3  libsqlite3.dylib               0x0000000193cb30ec (null) + 20388
4  libsqlite3.dylib               0x0000000193cb27ac (null) + 18020
5  libsqlite3.dylib               0x0000000193cb255c (null) + 17428
6  libsqlite3.dylib               0x0000000193c85688 (null) + 2624
7  libsqlite3.dylib               0x0000000193caccf0 (null) + 56216
8  libsqlite3.dylib               0x0000000193c9f368 sqlite3_step + 528
9  CoreData                       0x0000000181db47e8 _execute + 124
10 CoreData                       0x0000000181dc5574 -[NSSQLiteConnection fetchResultSet:usingFetchPlan:] + 1664
11 CoreData                       0x0000000181ec48f4 newFetchedRowsForFetchPlan_MT + 1544
12 CoreData                       0x0000000181dcf4bc -[NSSQLCore fetchRowForObjectID:] + 1080
13 CoreData                       0x0000000181dcedc0 -[NSSQLCore newValuesForObjectWithID:withContext:error:] + 280
14 CoreData                       0x0000000181e89524 __95-[NSPersistentStoreCoordinator(_NSInternalMethods) newValuesForObjectWithID:withContext:error:]_block_invoke + 76
15 CoreData                       0x0000000181e90028 gutsOfBlockToNSPersistentStoreCoordinatorPerform + 184
16 libdispatch.dylib              0x0000000193f89954 _dispatch_client_callout + 16
17 libdispatch.dylib              0x0000000193f931e4 _dispatch_barrier_sync_f_invoke + 76
18 CoreData                       0x0000000181e81e98 _perform + 180
19 CoreData                       0x0000000181dcebf0 -[NSPersistentStoreCoordinator(_NSInternalMethods) newValuesForObjectWithID:withContext:error:] + 160
20 CoreData                       0x0000000181dce210 _PFFaultHandlerLookupRow +    352
21 CoreData                       0x0000000181dcdc84 _PF_FulfillDeferredFault + 252
22 CoreData                       0x0000000181dcda70 _sharedIMPL_pvfk_core + 116
23 CoreData                       0x0000000181dde638 _PF_Handler_Public_GetProperty + 176
24 Foundation                     0x0000000182f2c7c4 _sortedObjectsUsingDescriptors + 384
25 Foundation                     0x0000000182f6a94c -[NSArray(NSKeyValueSorting) sortedArrayUsingDescriptors:] + 608
26 CoreData                       0x0000000181dba32c -[NSManagedObjectContext executeFetchRequest:error:] + 3796
27 MyApp                     0x00000001001b2b2c static MyApp.CacheHelper.fetchCacheEntriesInAscendingOrderByAccess (MyApp.CacheHelper.Type)(Swift.String) -> Swift.Optional<Swift.Array<Swift.AnyObject>> (CacheHelper.swift:155)
28 MyApp                     0x0000000100145ee8 function signature specialization <Arg[0] = Owned To Guaranteed> of MyApp.Base.controlCapacity (MyApp.Base)() -> () (Base.swift:45)
29 MyApp                     0x00000001001450a0 MyApp.Base.controlCapacity (MyApp.Base)() -> () (Base.swift)
30 MyApp                     0x0000000100145c74 MyApp.Base.setCacheEntryInternal (MyApp.Base)(MyApp.CacheEntry) -> () (Base.swift:120)
31 libdispatch.dylib              0x0000000193f89994 _dispatch_call_block_and_release + 24
32 libdispatch.dylib              0x0000000193f89954 _dispatch_client_callout + 16
33 libdispatch.dylib              0x0000000193f940a4 _dispatch_queue_drain + 1448
34 libdispatch.dylib              0x0000000193f8ca5c _dispatch_queue_invoke + 132

35 libdispatch.dylib              0x0000000193f96318 _dispatch_root_queue_drain + 720
36 libdispatch.dylib              0x0000000193f97c4c _dispatch_worker_thread3 + 108
37 libsystem_pthread.dylib        0x000000019416922c _pthread_wqthread + 816`

0 个答案:

没有答案