Analyzing a crashreport

Hello, I am currently trying to get my app on the App Store.

My app got rejected and I received a crashreport from App Review:

Incident Identifier: D332D16A-0DEE-468C-BC01-78F2F060907E
CrashReporter Key:   e42216ebe11ea92547acc5e909454c4abbbc19bc
Hardware Model:      iPad13,16
Process:             GoalPilot [9350]
Path:                /private/var/containers/Bundle/Application/C83C19D7-5490-436C-9A5B-4DBF0819BC09/GoalPilot.app/GoalPilot
Identifier:          com.Pixel.GoalPilot
Version:             1.0 (16)
AppStoreTools:       16F3
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.Pixel.GoalPilot [4403]

Date/Time:           2025-06-20 11:49:36.1207 +0100
Launch Time:         2025-06-20 11:48:50.1374 +0100
OS Version:          iPhone OS 18.5 (22F76)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000191b948c4
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [9350]

Triggered by Thread:  0

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libswiftCore.dylib            	       0x191b948c4 _assertionFailure(_:_:file:line:flags:) + 172
1   SwiftData                     	       0x25383508c 0x25378c000 + 692364
2   SwiftData                     	       0x25385b1b4 0x25378c000 + 848308
3   SwiftData                     	       0x253793964 0x25378c000 + 31076
4   SwiftData                     	       0x2537cc028 0x25378c000 + 262184
5   SwiftData                     	       0x2537cbcb4 0x25378c000 + 261300
6   SwiftData                     	       0x2537c8fa8 0x25378c000 + 249768
7   SwiftData                     	       0x2537ca81c 0x25378c000 + 256028
8   SwiftData                     	       0x25379d004 0x25378c000 + 69636
9   SwiftData                     	       0x25379d550 0x25378c000 + 70992
10  SwiftData                     	       0x253865428 0x25378c000 + 889896
11  SwiftData                     	       0x2538654b4 0x25378c000 + 890036
12  SwiftData                     	       0x25379d004 0x25378c000 + 69636
13  SwiftData                     	       0x25379d550 0x25378c000 + 70992
14  SwiftData                     	       0x25379c3bc 0x25378c000 + 66492
15  SwiftData                     	       0x25379bd44 0x25378c000 + 64836
16  SwiftData                     	       0x25379d52c 0x25378c000 + 70956
17  SwiftData                     	       0x25379aa4c 0x25378c000 + 59980
18  SwiftData                     	       0x253799ed8 0x25378c000 + 57048
19  SwiftData                     	       0x253799e38 0x25378c000 + 56888
20  SwiftData                     	       0x253799d28 0x25378c000 + 56616
21  SwiftData                     	       0x253799b60 0x25378c000 + 56160
22  SwiftData                     	       0x253799c78 0x25378c000 + 56440
23  _SwiftData_SwiftUI            	       0x2547c2b90 0x2547be000 + 19344
24  _SwiftData_SwiftUI            	       0x2547c0ed8 0x2547be000 + 11992
25  GoalPilot                     	       0x1025dd338 Question4View.customSection.getter (in GoalPilot) (Question4View.swift:62) + 1643320
26  GoalPilot                     	       0x1025dce1c Question4View.body.getter (in GoalPilot) (Question4View.swift:23) + 1642012
27  SwiftUICore                   	       0x25391116c specialized ViewBodyAccessor.updateBody(of:changed:) + 1252
28  SwiftUICore                   	       0x2538d5ee0 closure #1 in DynamicBody.updateValue() + 600
29  SwiftUICore                   	       0x2538d78b8 DynamicBody.updateValue() + 928
30  SwiftUICore                   	       0x2538cecb0 partial apply for implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 32
31  AttributeGraph                	       0x1c0a47418 AG::Graph::UpdateStack::update() + 524
32  AttributeGraph                	       0x1c0a46fec AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 420
33  AttributeGraph                	       0x1c0a47e34 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 712
34  AttributeGraph                	       0x1c0a40e30 AGGraphGetValue + 228
35  SwiftUICore                   	       0x2538d77c8 DynamicBody.updateValue() + 688
36  SwiftUICore                   	       0x2538cecb0 partial apply for implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 32
37  AttributeGraph                	       0x1c0a47418 AG::Graph::UpdateStack::update() + 524
38  AttributeGraph                	       0x1c0a46fec AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 420
39  AttributeGraph                	       0x1c0a47e34 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 712
40  AttributeGraph                	       0x1c0a40e30 AGGraphGetValue + 228
41  SwiftUICore                   	       0x253911b30 DynamicViewList.updateValue() + 584
42  SwiftUICore                   	       0x2538cecb0 partial apply for implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 32
43  AttributeGraph                	       0x1c0a47418 AG::Graph::UpdateStack::update() + 524
44  AttributeGraph                	       0x1c0a46fec AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 420
45  AttributeGraph                	       0x1c0a47e34 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 712
46  AttributeGraph                	       0x1c0a40e30 AGGraphGetValue + 228
47  SwiftUICore                   	       0x2539220e8 specialized implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 164
48  AttributeGraph                	       0x1c0a47418 AG::Graph::UpdateStack::update() + 524
49  AttributeGraph                	       0x1c0a46fec AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 420
50  AttributeGraph                	       0x1c0a47e34 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 712
51  AttributeGraph                	       0x1c0a40e30 AGGraphGetValue + 228
52  SwiftUICore                   	       0x2539147ec DynamicLayoutViewAdaptor.updatedItems() + 68
53  SwiftUICore                   	       0x2539143a8 specialized DynamicContainerInfo.updateItems(disableTransitions:) + 64
54  SwiftUICore                   	       0x253913638 specialized DynamicContainerInfo.updateValue() + 488
55  SwiftUICore                   	       0x253913444 specialized implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 24
56  AttributeGraph                	       0x1c0a47418 AG::Graph::UpdateStack::update() + 524
57  AttributeGraph                	       0x1c0a46fec AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 420
58  AttributeGraph                	       0x1c0a47e34 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 712
59  AttributeGraph                	       0x1c0a40e30 AGGraphGetValue + 228
60  SwiftUICore                   	       0x2538fa5a0 DynamicPreferenceCombiner.info.getter + 84
61  SwiftUICore                   	       0x2538fa148 DynamicPreferenceCombiner.value.getter + 220
62  SwiftUICore                   	       0x25390a74c implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 324
63  AttributeGraph                	       0x1c0a47418 AG::Graph::UpdateStack::update() + 524
64  AttributeGraph                	       0x1c0a46fec AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 420
65  AttributeGraph                	       0x1c0a47e34 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 712
66  AttributeGraph                	       0x1c0a40e30 AGGraphGetValue + 228
67  SwiftUICore                   	       0x2538fa37c DynamicPreferenceCombiner.value.getter + 784
68  SwiftUICore                   	       0x25390a74c implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 324
69  AttributeGraph                	       0x1c0a47418 AG::Graph::UpdateStack::update() + 524
70  AttributeGraph                	       0x1c0a46fec AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 420
71  AttributeGraph                	       0x1c0a4c368 AG::Subgraph::update(unsigned int) + 848
72  SwiftUICore                   	       0x253fe9cdc specialized GraphHost.runTransaction(_:do:id:) + 328
73  SwiftUICore                   	       0x2538d99f4 GraphHost.flushTransactions() + 180
74  SwiftUICore                   	       0x253bf4778 specialized GraphHost.asyncTransaction<A>(_:id:mutation:style:mayDeferUpdate:) + 748
75  SwiftUICore                   	       0x253a0e614 closure #1 in closure #2 in installObservationSlow<A>(accessList:attribute:) + 232
76  SwiftUICore                   	       0x253a0e454 closure #2 in installObservationSlow<A>(accessList:attribute:) + 132
77  libswiftObservation.dylib     	       0x271c3167c closure #1 in closure #1 in static ObservationTracking._installTracking(_:willSet:didSet:) + 104
78  libswiftObservation.dylib     	       0x271c37314 partial apply for closure #2 in closure #1 in static ObservationTracking._installTracking(_:willSet:didSet:) + 24
79  libswiftObservation.dylib     	       0x271c376ac partial apply for thunk for @escaping @callee_guaranteed @Sendable (@guaranteed AnyKeyPath) -> () + 32
80  libswiftObservation.dylib     	       0x271c35db0 specialized ObservationRegistrar.Context.willSet<A, B>(_:keyPath:) + 676
81  libswiftObservation.dylib     	       0x271c3645c specialized ObservationRegistrar.willSet<A, B>(_:keyPath:) + 60
82  libswiftObservation.dylib     	       0x271c30d80 ObservationRegistrar.withMutation<A, B, C>(of:keyPath:_:) + 80
83  GoalPilot                     	       0x10247bd7c closure #1 in OnboardingViewModel.updateBottomBar(transitionForward:) (in GoalPilot) (OnboardingViewModel.swift:156) + 195964
84  GoalPilot                     	       0x10247cc78 partial apply for closure #1 in OnboardingViewModel.updateBottomBar(transitionForward:) (in GoalPilot) (/<compiler-generated>:0) + 199800
85  SwiftUICore                   	       0x2539f6c18 closure #1 in withTransaction<A>(_:_:) + 308
86  SwiftUICore                   	       0x2539f6cc8 partial apply for closure #1 in withTransaction<A>(_:_:) + 28
87  SwiftUICore                   	       0x2538d10a0 withExtendedLifetime<A, B, C>(_:_:) + 156
88  SwiftUICore                   	       0x2539f6ac8 withTransaction<A>(_:_:) + 124
89  SwiftUI                       	       0x19846d278 withAnimation<A>(_:completionCriteria:_:completion:) + 268
90  GoalPilot                     	       0x10247b774 OnboardingViewModel.nextView() (in GoalPilot) (/<compiler-generated>:0) + 194420
91  GoalPilot                     	       0x10247bb38 OnboardingViewModel.BottomBarButton.performAction(goal:onboardingModel:modelContext:) (in GoalPilot) (OnboardingViewModel.swift:145) + 195384
92  GoalPilot                     	       0x102556718 closure #1 in OnboardingSequenceView.nextButton(_:) (in GoalPilot) (/<compiler-generated>:0) + 1091352
93  SwiftUI                       	       0x19868c0c0 <deduplicated_symbol> + 32
94  SwiftUI                       	       0x19859c294 <deduplicated_symbol> + 28
95  SwiftUI                       	       0x198c3e498 specialized static MainActor.assumeIsolated<A>(_:file:line:) + 132
96  SwiftUI                       	       0x198c12abc ButtonAction.callAsFunction() + 380
97  SwiftUI                       	       0x19813e3f8 <deduplicated_symbol> + 88
98  SwiftUI                       	       0x19868c0c0 <deduplicated_symbol> + 32
99  SwiftUI                       	       0x19859c294 <deduplicated_symbol> + 28
100 SwiftUI                       	       0x198c3e498 specialized static MainActor.assumeIsolated<A>(_:file:line:) + 132
101 SwiftUI                       	       0x198c12abc ButtonAction.callAsFunction() + 380
102 SwiftUI                       	       0x19813e3f8 <deduplicated_symbol> + 88
103 SwiftUI                       	       0x19863e7d4 ButtonBehavior.ended() + 176
104 SwiftUI                       	       0x19863f9c8 partial apply for implicit closure #2 in implicit closure #1 in ButtonBehavior.body.getter + 36
105 SwiftUI                       	       0x198b91620 partial apply for closure #1 in closure #2 in closure #1 in _ButtonGesture.internalBody.getter + 36
106 SwiftUI                       	       0x19859c294 <deduplicated_symbol> + 28
107 SwiftUI                       	       0x198c3e498 specialized static MainActor.assumeIsolated<A>(_:file:line:) + 132
108 SwiftUI                       	       0x198b8e3fc closure #2 in closure #1 in _ButtonGesture.internalBody.getter + 96
109 SwiftUI                       	       0x198b90c24 closure #2 in PrimitiveButtonGestureCallbacks.dispatch(phase:state:) + 124
110 SwiftUICore                   	       0x2539b95c0 <deduplicated_symbol> + 28
111 SwiftUICore                   	       0x2539b9594 <deduplicated_symbol> + 28
112 SwiftUI                       	       0x198316bac <deduplicated_symbol> + 28
113 SwiftUI                       	       0x1985430b8 <deduplicated_symbol> + 64
114 SwiftUICore                   	       0x253e9f25c Update.Action.callAsFunction() + 220
115 SwiftUICore                   	       0x2538ce0dc static Update.dispatchActions() + 1316
116 SwiftUICore                   	       0x2538cd578 static Update.end() + 212
117 SwiftUICore                   	       0x253e9edac static Update.enqueueAction(reason:_:) + 192
118 SwiftUI                       	       0x198847990 UIKitResponderEventBindingBridge.flushActions() + 328
119 SwiftUI                       	       0x198847a08 @objc UIKitResponderEventBindingBridge.flushActions() + 28
120 UIKitCore                     	       0x195e0015c -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 128
121 UIKitCore                     	       0x195dfffcc _UIGestureRecognizerSendTargetActions + 92
122 UIKitCore                     	       0x195dffd9c _UIGestureRecognizerSendActions + 268
123 UIKitCore                     	       0x195dff690 -[UIGestureRecognizer _updateGestureForActiveEvents] + 560
124 UIKitCore                     	       0x195d9de94 _UIGestureEnvironmentUpdate + 2484
125 UIKitCore                     	       0x195deb27c -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 336
126 UIKitCore                     	       0x195deb104 -[UIGestureEnvironment _updateForEvent:window:] + 188
127 UIKitCore                     	       0x195deac18 -[UIWindow sendEvent:] + 2932
128 UIKitCore                     	       0x195df7508 -[UIApplication sendEvent:] + 376
129 UIKitCore                     	       0x195da89a0 __dispatchPreprocessedEventFromEventQueue + 1052
130 UIKitCore                     	       0x195da7be4 __processEventQueue + 4812
131 UIKitCore                     	       0x195da14e4 updateCycleEntry + 160
132 UIKitCore                     	       0x195da1404 _UIUpdateSequenceRun + 84
133 UIKitCore                     	       0x195da0ab4 schedulerStepScheduledMainSection + 208
134 UIKitCore                     	       0x195d9c1e4 runloopSourceCallback + 92
135 CoreFoundation                	       0x1934b8a8c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
136 CoreFoundation                	       0x1934b88a4 __CFRunLoopDoSource0 + 172
137 CoreFoundation                	       0x1934b8700 __CFRunLoopDoSources0 + 232
138 CoreFoundation                	       0x1934b9080 __CFRunLoopRun + 840
139 CoreFoundation                	       0x1934bac3c CFRunLoopRunSpecific + 572
140 GraphicsServices              	       0x1e0699454 GSEventRunModal + 168
141 UIKitCore                     	       0x195ecd274 -[UIApplication _run] + 816
142 UIKitCore                     	       0x195e98a28 UIApplicationMain + 336
143 SwiftUI                       	       0x197fdd7a4 closure #1 in KitRendererCommon(_:) + 168
144 SwiftUI                       	       0x197ce301c runApp<A>(_:) + 112
145 SwiftUI                       	       0x197ce2ed0 static App.main() + 180
146 GoalPilot                     	       0x102453448 main (in GoalPilot) (GoalPilotApp.swift:0) + 29768
147 dyld                          	       0x1ba38ff08 start + 6040

Thread 1:
0   libsystem_pthread.dylib       	       0x21dae4aa4 start_wqthread + 0

Thread 2 name:  com.apple.uikit.eventfetch-thread
Thread 2:
0   libsystem_kernel.dylib        	       0x1e46c7ce4 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x1e46cb39c mach_msg2_internal + 76
2   libsystem_kernel.dylib        	       0x1e46cb2b8 mach_msg_overwrite + 428
3   libsystem_kernel.dylib        	       0x1e46cb100 mach_msg + 24
4   CoreFoundation                	       0x1934ba900 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x1934b91f0 __CFRunLoopRun + 1208
6   CoreFoundation                	       0x1934bac3c CFRunLoopRunSpecific + 572
7   Foundation                    	       0x19213279c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8   Foundation                    	       0x192138020 -[NSRunLoop(NSRunLoop) runUntilDate:] + 64
9   UIKitCore                     	       0x195eb756c -[UIEventFetcher threadMain] + 424
10  Foundation                    	       0x192198804 __NSThread__start__ + 732
11  libsystem_pthread.dylib       	       0x21dae7344 _pthread_start + 136
12  libsystem_pthread.dylib       	       0x21dae4ab8 thread_start + 8

Thread 3:
0   libsystem_pthread.dylib       	       0x21dae4aa4 start_wqthread + 0

Thread 4:
0   libsystem_pthread.dylib       	       0x21dae4aa4 start_wqthread + 0

Thread 5:
0   libsystem_pthread.dylib       	       0x21dae4aa4 start_wqthread + 0

Thread 6 name:  com.apple.SwiftUI.AsyncRenderer
Thread 6:
0   libsystem_kernel.dylib        	       0x1e46c7ce4 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x1e46cb39c mach_msg2_internal + 76
2   libsystem_kernel.dylib        	       0x1e46cb2b8 mach_msg_overwrite + 428
3   libsystem_kernel.dylib        	       0x1e46cb100 mach_msg + 24
4   CoreFoundation                	       0x1934ba900 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x1934b91f0 __CFRunLoopRun + 1208
6   CoreFoundation                	       0x1934bac3c CFRunLoopRunSpecific + 572
7   Foundation                    	       0x19213279c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8   Foundation                    	       0x192137108 -[NSRunLoop(NSRunLoop) run] + 64
9   SwiftUI                       	       0x1980852bc specialized static DisplayLink.asyncThread(arg:) + 792
10  SwiftUI                       	       0x198084f8c @objc static DisplayLink.asyncThread(arg:) + 72
11  Foundation                    	       0x192198804 __NSThread__start__ + 732
12  libsystem_pthread.dylib       	       0x21dae7344 _pthread_start + 136
13  libsystem_pthread.dylib       	       0x21dae4ab8 thread_start + 8


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x00000001381b7208   x1: 0x0000000200000003   x2: 0x0000000000000058   x3: 0xfffff0007fc00000
    x4: 0x0000000138586880   x5: 0x0000000000000013   x6: 0x0000000000000020   x7: 0x16ce9e5df9be65cd
    x8: 0xfffffffe00000000   x9: 0x0000000200000003  x10: 0x0000000000000003  x11: 0x0000000000000000
   x12: 0x0012209080403a80  x13: 0x0012108e804031c0  x14: 0x0000000000003800  x15: 0x000000000000004d
   x16: 0x952d000138586800  x17: 0x000000012108e9c0  x18: 0x0000000000000000  x19: 0x00000001381b4500
   x20: 0x000000016d9a9ed8  x21: 0x00000001fe1d3dd8  x22: 0x00000001381d4a80  x23: 0x00000001026a0f88
   x24: 0x00000001397b8000  x25: 0x00000001397d5980  x26: 0x00000001fe1ea7f0  x27: 0xf000000000000031
   x28: 0x00000002538955b0   fp: 0x000000016d9a9e70   lr: 0x0000000191b948c4
    sp: 0x000000016d9a9df0   pc: 0x0000000191b948c4 cpsr: 0x60001000
   far: 0x0000000000000000  esr: 0xf2000001 (Breakpoint) brk 1

Binary Images:
       0x10244c000 -        0x10267bfff GoalPilot arm64  <a8f25d2522bd3cab96bfdc2c8e1e0206> /var/containers/Bundle/Application/C83C19D7-5490-436C-9A5B-4DBF0819BC09/GoalPilot.app/GoalPilot
       0x10285c000 -        0x102867fff libobjc-trampolines.dylib arm64e  <9136d8ba22ff3f129caddfc4c6dc51de> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
       0x191b61000 -        0x1920ca19f libswiftCore.dylib arm64e  <b215a4918bca3d2d81cd39e3c145ea07> /usr/lib/swift/libswiftCore.dylib
       0x25378c000 -        0x2538bbe42 SwiftData arm64e  <c5a5ba93f3373ea4ac4e071f9d0e38da> /System/Library/Frameworks/SwiftData.framework/SwiftData
       0x2547be000 -        0x2547da5b8 _SwiftData_SwiftUI arm64e  <498eac194fa93c44b80a2bc2dc81d62e> /System/Library/Frameworks/_SwiftData_SwiftUI.framework/_SwiftData_SwiftUI
       0x2538bc000 -        0x25443cadf SwiftUICore arm64e  <d4a1e5b0b937369095667ef1af91cab8> /System/Library/Frameworks/SwiftUICore.framework/SwiftUICore
       0x1c0a3e000 -        0x1c0a8109f AttributeGraph arm64e  <3f57745ef22d35b6aa63db7041ffd20d> /System/Library/PrivateFrameworks/AttributeGraph.framework/AttributeGraph
       0x271c2c000 -        0x271c39ec7 libswiftObservation.dylib arm64e  <6d045d4c447733828ad7b44165975a30> /usr/lib/swift/libswiftObservation.dylib
       0x197cda000 -        0x198f5d33f SwiftUI arm64e  <165d3305401e37c28387c1bfb54cffde> /System/Library/Frameworks/SwiftUI.framework/SwiftUI
       0x195d98000 -        0x197cd9b5f UIKitCore arm64e  <96636f64106f30c8a78082dcebb0f443> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
       0x1934a9000 -        0x193a25fff CoreFoundation arm64e  <7821f73c378b3a10be90ef526b7dba93> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
       0x1e0698000 -        0x1e06a0c7f GraphicsServices arm64e  <5ba62c226d3731999dfd0e0f7abebfa9> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
       0x1ba351000 -        0x1ba3eb857 dyld arm64e  <86d5253d4fd136f3b4ab25982c90cbf4> /usr/lib/dyld
               0x0 - 0xffffffffffffffff ??? unknown-arch  <00000000000000000000000000000000> ???
       0x21dae4000 -        0x21daf03f3 libsystem_pthread.dylib arm64e  <b37430d8e3af33e481e1faed9ee26e8a> /usr/lib/system/libsystem_pthread.dylib
       0x1e46c7000 -        0x1e4700ebf libsystem_kernel.dylib arm64e  <9e195be11733345ea9bf50d0d7059647> /usr/lib/system/libsystem_kernel.dylib
       0x192123000 -        0x192d96ddf Foundation arm64e  <34de055d8683380a9198c3347211d13d> /System/Library/Frameworks/Foundation.framework/Foundation

EOF

I was already able to symbolicate half of it, but I’d like to symbolicate the addresses from the SwiftData binary as well, as they seem to be leading to the crash.

Does anyone know how to do this?

Thanks for your help!
-Rune

Have you tested it thoroughly on all devices?

I have tested it on all of our real iPhones at home and our iPad Air (M2 chip) + several Xcode simulators and the device on which App Review had the crash, an iPad Air (5th generation). However I do not have that device so I had to use the simulator for that one.

Strangely my app does not crash on any of my tests… so the crashreport is the most relevant information I have about the crash…

I hope this answers your question.

@Pixel

Hi Rune.

OK that’s fair comment

Apart from providing you with a crash report did the App Review team also provide you with the steps they were taking while using the App when the crash occurred? That would at least have pointed you in the right direction.

Years ago I worked for Telstra here in Australia. We were introducing an Oracle database application based on a Unix mainframe. My role was testing the application and it also involved percussion testing insofar as bashing multiple keys on the keyboard to try and break the application. That was to ensure that unexpected key presses were trapped. The point of telling you that is that I have no idea how Apple test an App and if they do unexpected things in order to try to break it.

Hi Chris!

Thanks for your help!

Yes, they did tell me what steps lead to the crash, they just entered their name, went on 2 more views in the onboarding and entered something else my app requests, and then they tap the “next” button and then it crashes. If you look at the crashreport, the last frame on Thread 0 is Question4View, this is the view that appears when the “next” button is tapped. And I think the app crashed when this view is being rendered the first time.

For your information, this is the view code for that view (I think it has something to do with the Query at the top, ChatGPT said the animation might be the cause, as it tries to animate an empty array of requirements):

import SwiftUI
import SwiftData

struct Question4View: View {
    @Environment(\.modelContext) private var modelContext
    @Environment(OnboardingViewModel.self) private var onboardingModel
    @Environment(Goal.self) private var goal
    
    @State private var inputTitle = ""
    @State private var inputInfo: String?
    
    @Query(Requirement.descriptor(), animation: .smooth) private var requirements: [Requirement]
    @FocusState private var focusedField: DualTextField.Field?
    
    var body: some View {
        QuestionViewLayout(
            preText: ("You’re making great progress! \nLet’s get more to the practical side.", .init()),
            title: ("What is required to achieve this?", .init()),
            tip: ("Try to pin point just a few things you certainly \nneed to achieve your pillars.", .init()),
            customSection: { customSection }
        )
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .dismissKeyboardArea {
            focusedField = nil
        }
        .onboardingBottomBarSetter {
            onboardingModel.nextButton = .init(actionRequiredLabel: "Please add the title for at least one requirement by clicking the plus button before continuing.", isDisabled: { !requirements.allSatisfy({ $0.isConfigured }) || requirements.isEmpty })
        }
    }
    
    private var customSection: some View {
        let inputView = InputView(
            firstInput: $inputTitle, firstPrompt: "Requirement",
            secondInput: $inputInfo.boundString,
            focusedField: $focusedField,
            addCompletion: {
                // Add Requirement
                let newRequirement = Requirement()
                newRequirement.title = inputTitle
                newRequirement.info = inputInfo
                newRequirement.insert(into: modelContext)
                
                // Establish parent relationship
                newRequirement.establishRelationship(for: \.parent, with: goal, within: modelContext)
                
                // Clean the text fields
                inputTitle = ""
                inputInfo = ""
                
                // Focus on the title text field
                if focusedField == .second { focusedField = .first }
            }
        )
        
        return ListView(focusedField: focusedField, inputView: { inputView }, listContent: requirements) { requirement in
            ItemRow(title: requirement.title, info: requirement.info, removeCompletion: {
                requirement.delete(from: modelContext)
            })
            .background(MaterialBackground())
        }
        .padding(.horizontal)
    }
}

// Elements for the sheet
extension Question4View {
    static var sheetView: some View {
        SheetViewLayout(mode: .example, title: "What is required to achieve this?") {
            // Custom Section
            VStack(spacing: 10) {
                ExampleUnfoldedRow(title: "Money", info: "I’ll need to earn enough money to be able to afford all my pillars and never worry about money.")
                
                ExampleUnfoldedRow(title: "Smart investments", info: "Through enough smart investments I’ll be able to earn passive income.")
                
                ExampleRow(text: "A loving partner.")
            }
            .padding(.horizontal)
        }
    }
}

Would it be reasonable to make the Query declaration optional and deal with it in your view code as appropriate.

ie:
@Query(Requirement.descriptor(), animation: .smooth) private var requirements: [Requirement]?

It might just work, but I have no way of testing it apart form submitting it to App Review… But why would it be a solution? I don’t fully understand it yet.

Yeah I understand that testing it is the issue. If you change it, does the App still work on all the devices you are able to test it on?

Given that ChatGPT was suggesting that the animation parameter might have something to do with it, maybe remove that parameter. Potentially ChatGPT may be way off the mark.

I haven’t made it optional yet, but I don’t think it’ll break anything…

Turns out you can’t make the value of a property wrapped with Query optional:
Element' is not a member type of generic enum '[GoalPilot.Requirement]?

Update: I now know what leads to the crash as I was able to install my app via TestFlight and reproduce the crash on my end. So I have the crash report in Xcode organizer, but I don’t know debugging very well and have debugged using a crash log in the organizer.

If anyone knows something about this, any help is appreciated.

Furthermore, I know that the crash happens when Question4View tries to get a value of its requirements query for the first time. I don’t know if my model is causing this or some inaccurate state, but here is model’s code anyway:

@Model
final class Requirement: Persistentable {
    var id: UUID
    var creationDate: Date
    var title: String
    var info: String?
    var isDeleted: Bool
    var parent: Goal?
    
    init() {
        self.id = UUID()
        self.creationDate = Date()
        self.title = ""
        self.isDeleted = false
    }
    
    
    // MARK: Persistentable
    var isConfigured: Bool { parent != nil && !title.isEmpty }
}
// Provides model specific functions for inserting, deleting and management.
protocol Persistentable: PersistentModel {
    associatedtype FetchResult: PersistentModel
    
    func establishRelationship<T: PersistentModel>(for property: ReferenceWritableKeyPath<Self, T?>, with model: T, within modelContext: ModelContext)
    
    // Inserts this model in the given model context and does any additional set up.
    func insert(into modelContext: ModelContext)
    
    // Deletes this model from the given model context and does any additional clean up.
    func delete(from modelContext: ModelContext)
    
    // This function is called right before the model is deleted.
    func preDeletion(_ modelContext: ModelContext)
    
    // Returns a fetch descriptor to fetch all relevant models of this type.
    static func descriptor() -> FetchDescriptor<FetchResult>
    
    // Whether the model will be deleted from the persistent store.
    var isDeleted: Bool { get set }
    
    // Whether the values represent a configured object of this type.
    var isConfigured: Bool { get }
}

// Default implementation
extension Persistentable {
    func establishRelationship<T: PersistentModel>(for property: ReferenceWritableKeyPath<Self, T?>, with model: T, within modelContext: ModelContext) {
        do {
            try modelContext.transaction {
                self[keyPath: property] = model
            }
        } catch {
            print("Failed to establish relationship for \(property.debugDescription) with \(model): \(error.localizedDescription)")
        }
    }
    
    func insert(into modelContext: ModelContext) {
        do {
            try modelContext.transaction { modelContext.insert(self) }
        } catch {
            print("Model insertion failed: \(error.localizedDescription)")
        }
    }
    
    func delete(from modelContext: ModelContext) {
        // Run the preDeletion
        preDeletion(modelContext)
        
        // Flag the deletion
        isDeleted = true
        
        // Delete the model
        do {
            try modelContext.transaction {
                modelContext.delete(self)
            }
        } catch {
            print("Model deletion failed: \(error.localizedDescription)")
        }
    }
    
    func preDeletion(_ modelContext: ModelContext) {}
    
    static func descriptor() -> FetchDescriptor<Self> {
        let predicate = #Predicate<Self> { !$0.isDeleted }
        return FetchDescriptor(predicate: predicate)
    }
}

// Correct access support
extension Persistentable {
    // The underlying value if it isn't flagged as deleted.
    var activeValue: Self? { // !! weak is to control references --> it expects ONLY A CLASS TYPE, but Self is a protocol so can be a struct, enum etc. + weak DOESN'T HAVE EFFECT ON COMPUTED PROPERTIES as they aren't stored, so any references to a class within it are deleted when exiting its scope !!
        isDeleted ? nil : self
    }
}

extension Array where Element: Persistentable {
    // The collection filtered for the elements that aren't flagged as deleted.
    var activeValues: Self {
        self.filter { !$0.isDeleted }
    }
}