I'm having trouble fixing a non-reproducible crash that's only appearing on a couple user devices. The exception is raised while changing the properties of a Core Data managed object, and then saving those changes. The users report that their changes are not persisted next time they open the app after the crash. Here is the crash log up to the binary images:
Hardware Model: iPhone12,5
Process: Pupl [25152]
Path: /private/var/containers/Bundle/Application/E75455E2-43A9-4C5C-BEFF-3E64F5046322/Pupl.app/Pupl
Identifier: com.kevinolmats.Pupl
Version: 285 (1.0.1)
AppStoreTools: 12A7402a
AppVariant: 1:iPhone12,5:14
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.kevinolmats.Pupl [1530]
Date/Time: 2020-10-25 09:57:57.2646 -0600
Launch Time: 2020-10-25 09:48:56.9577 -0600
OS Version: iPhone OS 14.0.1 (18A393)
Release Type: User
Baseband Version: 2.00.01
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x1935665ac __exceptionPreprocess + 220 (NSException.m:199)
1 libobjc.A.dylib 0x1a75e042c objc_exception_throw + 60 (objc-exception.mm:565)
2 CoreData 0x19961a648 _PFManagedObject_coerceValueForKeyWithDescription + 2004 (NSManagedObject.m:0)
3 CoreData 0x19961f6f4 _sharedIMPL_setvfk_core + 192 (NSManagedObject_Accessors.m:1412)
4 Pupl 0x100d96cac specialized WeightCategoryEditorViewModel.init(course:color:context:) + 596 (WeightCategoryEditorViewModel.swift:30)
5 Pupl 0x100d8d7a0 0x100d44000 + 300960
6 SwiftUI 0x199ed30b0 partial apply for implicit closure #2 in implicit closure #1 in DefaultListButtonStyle.ListButton.body.getter + 28 (PrimitiveButtonStyle.swift:47)
7 SwiftUI 0x199ddb9c4 thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:0)
8 SwiftUI 0x199e60e90 specialized closure #2 in PlatformItemList.containerSelectionBehavior.getter + 68 (<compiler-generated>:0)
9 SwiftUI 0x199efb3f8 ListCoreCoordinator.tableView(_:didSelectRowAt:) + 908 (ListCore_PhoneTV.swift:1250)
10 SwiftUI 0x199efb6e4 @objc ListCoreCoordinator.tableView(_:willBeginEditingRowAt:) + 136
11 UIKitCore 0x1960860d0 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:isCellMultiSelect:] + 1064 (UITableView.m:8278)
12 UIKitCore 0x196085c8c -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 112 (UITableView.m:8192)
13 UIKitCore 0x196086438 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 272 (UITableView.m:8317)
14 UIKitCore 0x19634b544 -[_UIAfterCACommitBlock run] + 72 (_UIAfterCACommitQueue.m:122)
15 UIKitCore 0x195e90400 _runAfterCACommitDeferredBlocks + 300 (UIApplication.m:2924)
16 UIKitCore 0x195e7f1bc _cleanUpAfterCAFlushAndRunDeferredBlocks + 204 (UIApplication.m:2902)
17 UIKitCore 0x195eb2648 _afterCACommitHandler + 80 (UIApplication.m:2958)
18 CoreFoundation 0x1934e2444 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 (CFRunLoop.c:1799)
19 CoreFoundation 0x1934dc858 __CFRunLoopDoObservers + 576 (CFRunLoop.c:1912)
20 CoreFoundation 0x1934dce08 __CFRunLoopRun + 1056 (CFRunLoop.c:2953)
21 CoreFoundation 0x1934dc4bc CFRunLoopRunSpecific + 600 (CFRunLoop.c:3242)
22 GraphicsServices 0x1a9f61820 GSEventRunModal + 164 (GSEvent.c:2259)
23 UIKitCore 0x195e80734 -[UIApplication _run] + 1072 (UIApplication.m:3270)
24 UIKitCore 0x195e85e10 UIApplicationMain + 168 (UIApplication.m:4739)
25 SwiftUI 0x19a23d32c closure #1 in KitRendererCommon(_:) + 112 (UIKitApp.swift:34)
26 SwiftUI 0x19a23d2b8 runApp<A>(_:) + 220 (<compiler-generated>:0)
27 SwiftUI 0x199db6b08 static App.main() + 140 (App.swift:113)
28 Pupl 0x100d5311c $main + 56 (Assignment.swift:0)
29 Pupl 0x100d5311c main + 68
30 libdyld.dylib 0x1931a3e60 start + 4
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001bf49798c __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001daabfc74 pthread_kill + 272 (pthread.c:1375)
2 libsystem_c.dylib 0x000000019c668bb4 abort + 104 (abort.c:110)
3 libc++abi.dylib 0x00000001a76dfe24 abort_message + 132 (abort_message.cpp:76)
4 libc++abi.dylib 0x00000001a76d1434 demangling_terminate_handler() + 308 (cxa_default_handlers.cpp:67)
5 libobjc.A.dylib 0x00000001a75e0710 _objc_terminate() + 132 (objc-exception.mm:701)
6 libc++abi.dylib 0x00000001a76df2a8 std::__terminate(void (*)()) + 20 (cxa_handlers.cpp:59)
7 libc++abi.dylib 0x00000001a76e2174 __cxa_rethrow + 148 (cxa_exception.cpp:617)
8 libobjc.A.dylib 0x00000001a75e05ec objc_exception_rethrow + 44 (objc-exception.mm:604)
9 CoreFoundation 0x00000001934dc5a8 CFRunLoopRunSpecific + 836 (CFRunLoop.c:3257)
10 GraphicsServices 0x00000001a9f61820 GSEventRunModal + 164 (GSEvent.c:2259)
11 UIKitCore 0x0000000195e80734 -[UIApplication _run] + 1072 (UIApplication.m:3270)
12 UIKitCore 0x0000000195e85e10 UIApplicationMain + 168 (UIApplication.m:4739)
13 SwiftUI 0x000000019a23d32c closure #1 in KitRendererCommon(_:) + 112 (UIKitApp.swift:34)
14 SwiftUI 0x000000019a23d2b8 runApp<A>(_:) + 220 (<compiler-generated>:0)
15 SwiftUI 0x0000000199db6b08 static App.main() + 140 (App.swift:113)
16 Pupl 0x0000000100d5311c $main + 56 (Assignment.swift:0)
17 Pupl 0x0000000100d5311c main + 68
18 libdyld.dylib 0x00000001931a3e60 start + 4
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0x000000016f0bad10 x5: 0x000000016f0bb2c0 x6: 0x000000000000006e x7: 0x0000000000000700
x8: 0x00000000000005b9 x9: 0x0d58175f700a1725 x10: 0x0000000000000002 x11: 0x0000000000000003
x12: 0x0000000000000000 x13: 0x0000000000000001 x14: 0x0000000000000010 x15: 0x0000000000000046
x16: 0x0000000000000148 x17: 0x00000001010838c0 x18: 0x000000010b9b6d8c x19: 0x0000000000000006
x20: 0x0000000000000407 x21: 0x00000001010839a0 x22: 0x0000000000000001 x23: 0x00000002835989d0
x24: 0x0000000000000000 x25: 0x0000000000000001 x26: 0x0000000eb1e31100 x27: 0x00000001e70b3000
x28: 0x0000000000000001 fp: 0x000000016f0bb220 lr: 0x00000001daabfc74
sp: 0x000000016f0bb200 pc: 0x00000001bf49798c cpsr: 0x40000000
esr: 0x56000080 Address size fault
Note the WeightCategoryEditorViewModel.init
on frame 4. This is the frame that changes between crash logs, but the subsequent frames are the same. Here's the init for the WeightCategoryEditorViewModel
:
/// Creates a new model which edits the given weight category.
init(weightCategory: WeightCategory, color: Color = .accentColor, context: NSManagedObjectContext) {
self.context = context
self.weightCategory = weightCategory
self.accentColor = color
self.isEditing = true
self.name = weightCategory.name
self.weight = String(format: "%.0f", weightCategory.weight)
}
Anyone know what my next steps should be?