仅在 iOS 14 中崩溃核心数据

fl0*_*0_9 5 core-data ios ios14

我在使用 CoreData 的应用程序上工作,在 iOS 13 和 iOS 14 上使用不同的 Xcode 测试版一切正常。但是自从 Apple 发布了 iOS 14 和 Xcode 12 的官方版本后,当我尝试从 CoreData 获取一些对象时发生了崩溃。

guard let customers = Customer.mr_findAllSorted(by: "login", ascending: true) as? [Customer] else { return }

控制台输出:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't get value for 'batch' in bindings {
}.'
Run Code Online (Sandbox Code Playgroud)

当我尝试使用断点从控制台日志打印对象时,我有对象的内存地址,但是当我尝试打印此对象的某些值时,出现此错误:

error: warning: couldn't get required object pointer (substituting NULL): Couldn't load 'self' because its value couldn't be evaluated

error: Execution was interrupted, reason: internal ObjC exception breakpoint(-5)..
The process has been returned to the state before expression evaluation.
Run Code Online (Sandbox Code Playgroud)

自正式版本以来,有没有人不得不处理这种类型的错误?

在此先感谢您的帮助。

arc*_*ten 2

我们在我们的应用程序中也看到了这一点。它只能在 iOS 14 和 Xcode 12.0.1 中的最新 SDK 中重现,但我们还没有任何解决方案或答案来解释为什么会发生这种情况。

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't get value for 'batch' in bindings {
}.'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff2043a126 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007fff20177f78 objc_exception_throw + 48
    2   Foundation                          0x00007fff2088bedc -[NSVariableExpression _expressionWithSubstitutionVariables:] + 0
    3   Foundation                          0x00007fff2075ac7b -[NSComparisonPredicate evaluateWithObject:substitutionVariables:] + 264
    4   CoreData                            0x00007fff2511ec68 -[NSDictionaryStoreMap handleFetchRequest:] + 481
    5   CoreData                            0x00007fff2511dfd2 -[NSMappedObjectStore executeFetchRequest:withContext:] + 230
    6   CoreData                            0x00007fff251e10a2 __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke.797 + 3219
    7   CoreData                            0x00007fff251d988d __55-[NSPersistentStoreCoordinator _routeHeavyweightBlock:]_block_invoke + 55
    8   CoreData                            0x00007fff251edf0a gutsOfBlockToNSPersistentStoreCoordinatorPerform + 182
    9   libdispatch.dylib                   0x000000010a6b0a88 _dispatch_client_callout + 8
    10  libdispatch.dylib                   0x000000010a6bfcac _dispatch_lane_barrier_sync_invoke_and_complete + 132
    11  CoreData                            0x00007fff251d9492 _perform + 169
    12  CoreData                            0x00007fff251d9740 -[NSPersistentStoreCoordinator _routeHeavyweightBlock:] + 172
    13  CoreData                            0x00007fff250d640e -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1684
    14  CoreData                            0x00007fff250d49c2 -[NSManagedObjectContext executeFetchRequest:error:] + 885
    15  CoreData                            0x00007fff251a9d7f -[NSManagedObjectContext _parentObjectsForFetchRequest:inContext:error:] + 477
    16  CoreData                            0x00007fff251aa774 __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke + 603
    17  CoreData                            0x00007fff25109de8 internalBlockToNSManagedObjectContextPerform + 89
    18  libdispatch.dylib                   0x000000010a6b0a88 _dispatch_client_callout + 8
    19  libdispatch.dylib                   0x000000010a6bfcac _dispatch_lane_barrier_sync_invoke_and_complete + 132
    20  CoreData                            0x00007fff25109d6f _perform + 196
    21  CoreData                            0x00007fff25109b93 -[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:] + 175
    22  CoreData                            0x00007fff250d49c2 -[NSManagedObjectContext executeFetchRequest:error:] + 885
    23  CoreData                            0x00007fff251a9d7f -[NSManagedObjectContext _parentObjectsForFetchRequest:inContext:error:] + 477
    24  CoreData                            0x00007fff251aa774 __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke + 603
    25  CoreData                            0x00007fff25109de8 internalBlockToNSManagedObjectContextPerform + 89
    26  libdispatch.dylib                   0x000000010a6b0a88 _dispatch_client_callout + 8
    27  libdispatch.dylib                   0x000000010a6bfe11 _dispatch_async_and_wait_invoke + 175
    28  libdispatch.dylib                   0x000000010a6b0a88 _dispatch_client_callout + 8
    29  libdispatch.dylib                   0x000000010a6bef23 _dispatch_main_queue_callback_4CF + 1152
    30  CoreFoundation                      0x00007fff203a8276 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    31  CoreFoundation                      0x00007fff203a2b06 __CFRunLoopRun + 2685
    32  CoreFoundation                      0x00007fff203a1b9e CFRunLoopRunSpecific + 567
    33  GraphicsServices                    0x00007fff2b773db3 GSEventRunModal + 139
    34  UIKitCore                           0x00007fff24660af3 -[UIApplication _run] + 912
    35  UIKitCore                           0x00007fff24665a04 UIApplicationMain + 101
    36  XXXX                                0x0000000106de2d69 main + 153
    37  libdyld.dylib                       0x00007fff20257415 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't get value for 'batch' in bindings {
}.'
Run Code Online (Sandbox Code Playgroud)