微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

请帮助更好地了解崩溃崩溃的详细信息:使用iOS 14上的Core Data,Xcode 12

如何解决请帮助更好地了解崩溃崩溃的详细信息:使用iOS 14上的Core Data,Xcode 12

在这方面没有很多经验。我没有对代码进行任何更改,但是在iOS 14之后,我开始崩溃,并且仅适用于iOS 14操作系统。核心数据可能有所变化吗?这是崩溃日志详细信息和Firebase。非常感谢!

我试图抓住它,这就是我发现的东西:

==13048==ERROR: AddressSanitizer: allocator is out of memory trying to allocate 0x1a0 bytes
==13048==FATAL: AddressSanitizer: internal allocator is out of memory trying to allocate 0x50 bytes
AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report.
(lldb)  thread info -s
thread #1: tid = 0x12fa63,0x00000001041961f8 libclang_rt.asan_ios_dynamic.dylib`__asan::AsanDie(),queue = 'sqlQueue 0x16572e2c0 for MyApp.sqlite',stop reason = AddressSanitizer detected: out-of-memory

{
  "access_size": 0,"access_type": 0,"address": 0,"description": "out-of-memory","instrumentation_class": "AddressSanitizer","pc": 0,"stop_type": "fatal_error"
}

我的功能,我认为我遇到了崩溃。

 (NSMutableArray *)getobjectsforEntity:(Nsstring *)strEntity sortBy:(Nsstring *)strSort isAscending:(BOOL)ascending predicate:(nspredicate *)predicate {
    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:strEntity];
    if (strSort) {
        NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:strSort ascending:ascending];
        [fetchRequest setSortDescriptors:[NSArray arrayWithObject:sort]];
    }
    if (predicate) {

        [fetchRequest setPredicate:predicate];
    }
    NSError *error;
    NSMutableArray *result = [[[[self managedobjectContext] executeFetchRequest:fetchRequest error:&error] mutablecopy ]autorelease];
    if (result == nil) {
        return [[NSMutableArray alloc] init];
    }
    return result;
}

崩溃日志 线程5崩溃: 0 CoreData 0x000000019d9fb6b8 _PFObjectIDFastHash64 + 36(NSBasicObjectID.m:707) 1个CoreData 0x000000019d9fb6b4 _PFObjectIDFastHash64 + 32(NSBasicObjectID.m:706) 2 CoreFoundation 0x0000000197c1c10c __CFBasicHashRehash + 996(CFBasicHash.c:477) 3 CoreFoundation 0x0000000197c1fdf4 CFBasicHashRemoveValue + 2352(CFBasicHash.c:1386) 4 CoreFoundation 0x0000000197b3e2f8 CFDictionaryRemoveValue + 224(CFDictionary.c:471) 5 CoreData 0x000000019d94b8e8-[NSManagedobjectContext(_NSInternalAdditions)_forgetobject:propagatetoObjectStore:removeFromregistry:] + 120(NSManagedobjectContext.m:5088) 6 CoreData 0x000000019d92b450-[_ PFManagedobjectReferenceQueue _processReferenceQueue:] + 864(NSManagedobjectContext.m:5077) 7 CoreData 0x000000019da43578 __90- [NSManagedobjectContext(_NSInternalNotificationHandling)_registerasyncReferenceCallback] _block_invoke + 68(NSManagedobjectContext.m:8825) 8 CoreData 0x000000019da39b18 developerSubmittedBlockToNSManagedobjectContextPerform + 156(NSManagedobjectContext.m:3880) 9 libdispatch.dylib 0x000000019782b280 _dispatch_client_callout + 16(object.m:559) 10 libdispatch.dylib 0x00000001977d3fa8 _dispatch_lane_serial_drain $ VARIANT $ mp + 612(inline_internal.h:2548) 11 libdispatch.dylib 0x00000001977d4a84 _dispatch_lane_invoke $ VARIANT $ mp + 424(queue.c:3862) 12 libdispatch.dylib 0x00000001977de518 _dispatch_workloop_worker_thread + 712(queue.c:6590) 13 libsystem_pthread.dylib 0x00000001dc7005a4 _pthread_wqthread + 272(pthread.c:2193) 14 libsystem_pthread.dylib 0x00000001dc703874 start_wqthread + 8

Thread 5 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000155e57240
    x4: 0x0000000155e570c0   x5: 0x0000000155f2d800   x6: 0x0000000000000015   x7: 0x0000000000000000
    x8: 0x0000000000000005   x9: 0x000000019d9fb694  x10: 0x0000000157008200  x11: 0x0000000197dc6c60
   x12: 0x0000000000000002  x13: 0x0000000000080003  x14: 0x00000000deeea853  x15: 0x000000000000bed5
   x16: 0x00000001ab41abec  x17: 0x0000000000000002  x18: 0x0000000000000000  x19: 0x0000000000000000
   x20: 0x0000000000000000  x21: 0x0000000000000000  x22: 0x0000000155f80520  x23: 0x0000000000000047
   x24: 0x0000000000000000  x25: 0x0000000281857980  x26: 0x0000000000000001  x27: 0x0000000282e2c068
   x28: 0x0000000000000047   fp: 0x000000016f716070   lr: 0x000000019d9fb6b4
    sp: 0x000000016f716060   pc: 0x000000019d9fb6b8 cpsr: 0x80000000
   esr: 0x92000005 (Data Abort) byte read Translation fault

Firebase

第一次崩溃

Crashed: com.apple.main-thread
0  CoreData                       0x1abc966b8 _PFObjectIDFastHash64 + 36
1  CoreFoundation                 0x1a5eb710c __CFBasicHashRehash + 996
2  CoreFoundation                 0x1a5ebadf4 CFBasicHashRemoveValue + 2352
3  CoreFoundation                 0x1a5dd92f8 CFDictionaryRemoveValue + 224
4  CoreData                       0x1abbe68e8 -[NSManagedobjectContext(_NSInternalAdditions) _forgetobject:propagatetoObjectStore:removeFromregistry:] + 120
5  CoreData                       0x1abbc6450 -[_PFManagedobjectReferenceQueue _processReferenceQueue:] + 864
6  CoreData                       0x1abc8e914 -[_PFAutoreleasePoolThunk dealloc] + 40
7  libobjc.A.dylib                0x1b96d2584 AutoreleasePoolPage::releaseUntil(objc_object**) + 200
8  libobjc.A.dylib                0x1b96d2460 objc_autoreleasePoolPop + 208
9  CoreFoundation                 0x1a5e98a1c _CFAutoreleasePoolPop + 28
10 CoreFoundation                 0x1a5e0da30 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
11 CoreFoundation                 0x1a5e0d634 __CFRunLoopDoTimer + 1004
12 CoreFoundation                 0x1a5e0cb14 __CFRunLoopDoTimers + 324
13 CoreFoundation                 0x1a5e06eb0 __CFRunLoopRun + 1912
14 CoreFoundation                 0x1a5e06200 CFRunLoopRunSpecific + 572
15 GraphicsServices               0x1bbf01598 GSEventRunModal + 160
16 UIKitCore                      0x1a86cc004 -[UIApplication _run] + 1052
17 UIKitCore                      0x1a86d15d8 UIApplicationMain + 164
18 MyApp                          0x100a53a00 main + 14 (AppDelegate.swift:14)
19 libdyld.dylib                  0x1a5ae5598 start + 4

第二次崩溃

Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x1b791e148 object_getClass + 12
1  CoreData                       0x1a9f026b0 _PFObjectIDFastHash64 + 28
2  CoreFoundation                 0x1a412310c __CFBasicHashRehash + 996
3  CoreFoundation                 0x1a4126df4 CFBasicHashRemoveValue + 2352
4  CoreFoundation                 0x1a40452f8 CFDictionaryRemoveValue + 224
5  CoreData                       0x1a9e528e8 -[NSManagedobjectContext(_NSInternalAdditions) _forgetobject:propagatetoObjectStore:removeFromregistry:] + 120
6  CoreData                       0x1a9e32450 -[_PFManagedobjectReferenceQueue _processReferenceQueue:] + 864
7  CoreData                       0x1a9efa914 -[_PFAutoreleasePoolThunk dealloc] + 40
8  libobjc.A.dylib                0x1b793e584 AutoreleasePoolPage::releaseUntil(objc_object**) + 200
9  libobjc.A.dylib                0x1b793e460 objc_autoreleasePoolPop + 208
10 libdispatch.dylib              0x1a3d0e514 _dispatch_lane_serial_drain$VARIANT$armv81 + 592
11 libdispatch.dylib              0x1a3d0f01c _dispatch_lane_invoke$VARIANT$armv81 + 456
12 libdispatch.dylib              0x1a3d144a0 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 576
13 CoreFoundation                 0x1a4078c30 __CFRUNLOOP_IS_SERVICING_THE_MAIN_disPATCH_QUEUE__ + 12
14 CoreFoundation                 0x1a40730e8 __CFRunLoopRun + 2480
15 CoreFoundation                 0x1a4072200 CFRunLoopRunSpecific + 572
16 GraphicsServices               0x1ba16d598 GSEventRunModal + 160
17 UIKitCore                      0x1a6938004 -[UIApplication _run] + 1052
18 UIKitCore                      0x1a693d5d8 UIApplicationMain + 164
19 MyApp                          0x1005e6d50 main + 15 (AppDelegate.swift:15)
20 libdyld.dylib                  0x1a3d51598 start + 4

第三次崩溃

Crashed: NSManagedobjectContext 0x2826edc70
0  libsystem_kernel.dylib         0x1b429195c __pthread_kill + 8
1  libsystem_pthread.dylib        0x1cebbb9e8 pthread_kill + 212
2  libsystem_c.dylib              0x192cf8934 abort + 100
3  libsystem_malloc.dylib         0x1989c2030 _malloc_put + 554
4  libsystem_malloc.dylib         0x1989c22a4 malloc_zone_error + 100
5  libsystem_malloc.dylib         0x1989ab9f0 szone_free + 460
6  CoreFoundation                 0x18a0d86bc __CFBasicHashRehash + 2452
7  CoreFoundation                 0x18a0dbdf4 CFBasicHashRemoveValue + 2352
8  CoreFoundation                 0x189ffa2f8 CFDictionaryRemoveValue + 224
9  CoreData                       0x18fe078e8 -[NSManagedobjectContext(_NSInternalAdditions) _forgetobject:propagatetoObjectStore:removeFromregistry:] + 120
10 CoreData                       0x18fde7450 -[_PFManagedobjectReferenceQueue _processReferenceQueue:] + 864
11 CoreData                       0x18feff578 __90-[NSManagedobjectContext(_NSInternalNotificationHandling) _registerasyncReferenceCallback]_block_invoke + 68
12 CoreData                       0x18fef5b18 developerSubmittedBlockToNSManagedobjectContextPerform + 156
13 libdispatch.dylib              0x189ce7280 _dispatch_client_callout + 16
14 libdispatch.dylib              0x189c8ffa8 _dispatch_lane_serial_drain$VARIANT$mp + 612
15 libdispatch.dylib              0x189c90a84 _dispatch_lane_invoke$VARIANT$mp + 424
16 libdispatch.dylib              0x189c9a518 _dispatch_workloop_worker_thread + 712
17 libsystem_pthread.dylib        0x1cebbc5a4 _pthread_wqthread + 272
18 libsystem_pthread.dylib        0x1cebbf874 start_wqthread + 8

解决方法

您正在寻找的错误是这个

CoreData 0x000000019da39b18 developerSubmittedBlockToNSManagedObjectContextPerform + 156

这通常意味着您要在一个上下文中创建对象,然后在另一个上下文中保存。

通过添加Core Data的启动参数,例如-com.apple.CoreData.ConcurrencyDebug 1

,您应该能够找出问题所在。

您可以在出色的article中阅读有关调试的更多信息。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。