ersjoh
ersjoh

Reputation: 331

SwiftUI Apple Watch app crash on release build (Series 3 only)

I have a very strange crash that occurs on Release builds (App Store + TestFlight) and on Apple Watch Series 3 only. If I run it on debug on my Series 3 it works fine. On newer watches (Series 4+) the App Store and debug versions work fine.

My watch app uses SwiftUI. Does anybody know what is going on here? Is this a SwiftUI bug or am I doing something wrong?

This is the crash log that I'm getting from the Series 3 (symbolicated):

Incident Identifier: B1210338-BE7E-4296-816B-5C07B3B2796A
Beta Identifier:     030172D5-8766-4A2C-B988-12A27F1DB754
Hardware Model:      Watch3,2
Process:             Thirstic [279]
Path:                /private/var/containers/Bundle/Application/8A4A4A35-2570-44BE-9767-E6B8EFE31369/ThirsticWatch.app/PlugIns/Thirstic.appex/Thirstic
Identifier:          co.tapcode.thirstic.watchkitapp.watchkitextension
Version:             24 (2020.2)
AppVariant:          1:Watch3,2:7
Beta:                YES
Code Type:           ARM (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           co.tapcode.thirstic.watchkitapp [343]


Date/Time:           2020-10-13 11:12:41.5505 +0200
Launch Time:         2020-10-13 11:12:40.0000 +0200
OS Version:          Watch OS 7.0.2 (18R402)
Release Type:        User
Baseband Version:    5.02.01
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Application Specific Information:
abort() called

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x416e8358 __pthread_kill + 8
1   libsystem_pthread.dylib         0x417638e2 pthread_kill + 170
2   libsystem_c.dylib               0x4166650e abort + 86
3   libswiftCore.dylib              0x6768dee6 swift_vasprintf+ 2506470 (char**, char const*, char*) + 0
4   libswiftCore.dylib              0x67697852 swift_initClassMetadata + 0
5   libswiftCore.dylib              0x6769789c _swift_initClassMetadataImpl+ 2545820 (swift::TargetClassMetadata<swift::InProcess>*, swift::ClassLayoutFlags, unsigned long, swift::TypeLayout const* const*, unsigned long*, bool) + 44
6   libswiftCore.dylib              0x67698416 swift_initClassMetadata2 + 22
7   Thirstic                        0x000e9950 _hidden#4114_ + 366928 (__hidden#304_:0)
8   libswiftCore.dylib              0x67696438 swift_getSingletonMetadata + 720
9   Thirstic                        0x000e9786 type metadata accessor for WaterNeedsTimeline + 366470 (__hidden#304_:0)
10  libswiftCore.dylib              0x676a4bf8 swift::Demangle::TypeDecoder<(anonymous namespace)::DecodedMetadataBuilder>::decodeMangledType+ 2599928 (swift::Demangle::Node*) + 2624
11  libswiftCore.dylib              0x676a4492 swift::Demangle::TypeDecoder<(anonymous namespace)::DecodedMetadataBuilder>::decodeMangledType+ 2598034 (swift::Demangle::Node*) + 730
12  libswiftCore.dylib              0x676a3c14 swift_getTypeByMangledNodeImpl(swift::MetadataRequest, swift::Demangle::Demangler&, swift::Demangle::Node*, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* + 2595860 (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 250
13  libswiftCore.dylib              0x676a3ae6 swift::swift_getTypeByMangledNode(swift::MetadataRequest, swift::Demangle::Demangler&, swift::Demangle::Node*, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* + 2595558 (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 310
14  libswiftCore.dylib              0x676a3e90 swift_getTypeByMangledNameImpl(swift::MetadataRequest, llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* + 2596496 (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 556
15  libswiftCore.dylib              0x676a24b4 swift::swift_getTypeByMangledName(swift::MetadataRequest, llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* + 2589876 (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 310
16  libswiftCore.dylib              0x676c7870 (anonymous namespace)::getFieldAt+ 2742384 (swift::TargetMetadata<swift::InProcess> const*, unsigned int) + 378
17  libswiftCore.dylib              0x676c7d50 (anonymous namespace)::ClassImpl::childMetadata(long, char const**, void (**)+ 2743632 (char const*)) + 16
18  libswiftCore.dylib              0x676c7eae (anonymous namespace)::ClassImpl::recursiveChildMetadata(long, char const**, void (**)+ 2743982 (char const*)) + 56
19  libswiftCore.dylib              0x676c6b40 swift_reflectionMirror_recursiveChildMetadata + 360
20  libswiftCore.dylib              0x675399e4 _forEachField+ 1112548 (of:options:body:) + 112
21  Combine                         0x5de66dfa ObservableObject<>.objectWillChange.getter + 228
22  Thirstic                        0x0009a172 protocol witness for ObservableObject.objectWillChange.getter in conformance TodayViewModel + 41330 (<compiler-generated>:0)
23  Combine                         0x5de6894e dispatch thunk of ObservableObject.objectWillChange.getter + 10
24  SwiftUI                         0x44d7099a ObservedObjectPropertyBox.update+ 5437850 (property:phase:) + 118
25  SwiftUI                         0x44aa0448 static BoxVTable.update+ 2487368 (ptr:property:phase:) + 164
26  SwiftUI                         0x44aa015c _DynamicPropertyBuffer.update+ 2486620 (container:phase:) + 48
27  SwiftUI                         0x44c493d2 StateObject.Box.update+ 4228050 (property:phase:) + 110
28  SwiftUI                         0x44aa0448 static BoxVTable.update+ 2487368 (ptr:property:phase:) + 164
29  SwiftUI                         0x44aa015c _DynamicPropertyBuffer.update+ 2486620 (container:phase:) + 48
30  SwiftUI                         0x44e8c21e DynamicBody.updateValue+ 6599198 () + 402
31  SwiftUI                         0x4493b906 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1026310 (_:) + 20
32  AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
33  AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
34  AttributeGraph                  0x450fa104 AG::Graph::input_value_ref_slow+ 37124 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 402
35  AttributeGraph                  0x45106984 AGGraphGetValue + 170
36  SwiftUI                         0x44a878b4 SubscriptionView.ChildAttribute.view.getter + 50
37  SwiftUI                         0x44a879ea SubscriptionView.ChildAttribute.updateValue+ 2386410 () + 286
38  SwiftUI                         0x4493b906 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1026310 (_:) + 20
39  AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
40  AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
41  AttributeGraph                  0x450fa104 AG::Graph::input_value_ref_slow+ 37124 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 402
42  AttributeGraph                  0x45106984 AGGraphGetValue + 170
43  SwiftUI                         0x44e8b522 StaticBody.container.getter + 50
44  SwiftUI                         0x44e8be8c closure #1 in StaticBody.value.getter + 84
45  SwiftUI                         0x44e8bbd4 StaticBody.value.getter + 476
46  SwiftUI                         0x44e8c070 protocol witness for Rule.value.getter in conformance StaticBody<A> + 8
47  AttributeGraph                  0x45108cb8 dispatch thunk of Rule.value.getter + 10
48  SwiftUI                         0x4490609a implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 807066 (_:) + 42
49  SwiftUI                         0x44922270 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 922224 (_:) + 22
50  AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
51  AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
52  AttributeGraph                  0x450fa104 AG::Graph::input_value_ref_slow+ 37124 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 402
53  AttributeGraph                  0x45106984 AGGraphGetValue + 170
54  SwiftUI                         0x44e8c1cc DynamicBody.updateValue+ 6599116 () + 320
55  SwiftUI                         0x4493b906 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1026310 (_:) + 20
56  AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
57  AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
58  AttributeGraph                  0x450fa104 AG::Graph::input_value_ref_slow+ 37124 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 402
59  AttributeGraph                  0x45106984 AGGraphGetValue + 170
60  SwiftUI                         0x44cf133c GeometryReader.Child.view.getter + 26
61  SwiftUI                         0x44cf143c GeometryReader.Child.updateValue+ 4916284 () + 240
62  SwiftUI                         0x4493b906 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1026310 (_:) + 20
63  AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
64  AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
65  AttributeGraph                  0x450fa104 AG::Graph::input_value_ref_slow+ 37124 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 402
66  AttributeGraph                  0x45106984 AGGraphGetValue + 170
67  SwiftUI                         0x44e8c1cc DynamicBody.updateValue+ 6599116 () + 320
68  SwiftUI                         0x4493b906 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1026310 (_:) + 20
69  AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
70  AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
71  AttributeGraph                  0x450fa104 AG::Graph::input_value_ref_slow+ 37124 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 402
72  AttributeGraph                  0x45106984 AGGraphGetValue + 170
73  SwiftUI                         0x44c2fda2 EnvironmentReadingChild.updateValue+ 4124066 () + 214
74  SwiftUI                         0x4493b906 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1026310 (_:) + 20
75  AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
76  AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
77  AttributeGraph                  0x450fa104 AG::Graph::input_value_ref_slow+ 37124 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 402
78  AttributeGraph                  0x45106984 AGGraphGetValue + 170
79  SwiftUI                         0x44e7d20c IsAnimated.updateValue+ 6537740 () + 44
80  SwiftUI                         0x4493b906 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1026310 (_:) + 20
81  AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
82  AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
83  AttributeGraph                  0x450fa104 AG::Graph::input_value_ref_slow+ 37124 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 402
84  AttributeGraph                  0x45106984 AGGraphGetValue + 170
85  SwiftUI                         0x44a838e8 HostPreferencesTransform.updateValue+ 2369768 () + 252
86  SwiftUI                         0x4493b906 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1026310 (_:) + 20
87  AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
88  AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
89  AttributeGraph                  0x450fa104 AG::Graph::input_value_ref_slow+ 37124 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 402
90  AttributeGraph                  0x45106984 AGGraphGetValue + 170
91  SwiftUI                         0x44cf217c PairPreferenceCombiner.value.getter + 56
92  SwiftUI                         0x44cf2220 protocol witness for Rule.value.getter in conformance PairPreferenceCombiner<A> + 20
93  AttributeGraph                  0x45108cb8 dispatch thunk of Rule.value.getter + 10
94  SwiftUI                         0x4490609a implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 807066 (_:) + 42
95  SwiftUI                         0x44922270 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 922224 (_:) + 22
96  AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
97  AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
98  AttributeGraph                  0x450fa104 AG::Graph::input_value_ref_slow+ 37124 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 402
99  AttributeGraph                  0x45106984 AGGraphGetValue + 170
100 SwiftUI                         0x44a8382e HostPreferencesTransform.updateValue+ 2369582 () + 66
101 SwiftUI                         0x4493b906 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1026310 (_:) + 20
102 AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
103 AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
104 AttributeGraph                  0x450fa104 AG::Graph::input_value_ref_slow+ 37124 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 402
105 AttributeGraph                  0x45106984 AGGraphGetValue + 170
106 SwiftUI                         0x44a8382e HostPreferencesTransform.updateValue+ 2369582 () + 66
107 SwiftUI                         0x4493b906 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1026310 (_:) + 20
108 AttributeGraph                  0x450f612e AG::Graph::UpdateStack::update+ 20782 () + 422
109 AttributeGraph                  0x450f64ee AG::Graph::update_attribute+ 21742 (AG::data::ptr<AG::Node>, bool) + 264
110 AttributeGraph                  0x450f9cc0 AG::Graph::value_ref+ 36032 (AG::AttributeID, AGSwiftMetadata const*, bool*) + 102
111 AttributeGraph                  0x451069c2 AGGraphGetValue + 232
112 SwiftUI                         0x44e24296 GraphHost.updatePreferences+ 6173334 () + 38
113 SwiftUI                         0x44c5f2a4 ViewGraph.updateOutputs+ 4317860 (at:) + 64
114 SwiftUI                         0x44e6a488 closure #1 in ViewRendererHost.render+ 6460552 (interval:updateDisplayList:) + 1176
115 SwiftUI                         0x44e6367c ViewRendererHost.render+ 6432380 (interval:updateDisplayList:) + 252
116 SwiftUI                         0x44f3ada4 _UIHostingView.layoutSubviews+ 7314852 () + 128
117 SwiftUI                         0x44f3adce @objc _UIHostingView.layoutSubviews+ 7314894 () + 18
118 UIKitCore                       0x5d082ce8 -[UIView+ 13118696 (CALayerDelegate) layoutSublayersOfLayer:] + 2002
119 QuartzCore                      0x46d0121e -[CALayer layoutSublayers] + 232
120 QuartzCore                      0x46d0644c CA::Layer::layout_if_needed+ 1213516 (CA::Transaction*) + 402
121 QuartzCore                      0x46d10af4 CA::Layer::layout_and_display_if_needed+ 1256180 (CA::Transaction*) + 62
122 QuartzCore                      0x46c7c120 CA::Context::commit_transaction+ 647456 (CA::Transaction*, double, double*) + 368
123 QuartzCore                      0x46c9d7e0 CA::Transaction::commit+ 784352 () + 712
124 UIKitCore                       0x5cca6768 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 72
125 CoreFoundation                  0x41a11cbe __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
126 CoreFoundation                  0x41a11164 __CFRunLoopDoBlocks + 362
127 CoreFoundation                  0x41a0c91c __CFRunLoopRun + 692
128 CoreFoundation                  0x41a0c18a CFRunLoopRunSpecific + 474
129 GraphicsServices                0x451f2eb6 GSEventRunModal + 134
130 UIKitCore                       0x5cc8df7e -[UIApplication _run] + 1044
131 UIKitCore                       0x5cc92afa UIApplicationMain + 114
132 WatchKit                        0x5333143c WKExtensionMain + 680
133 libdyld.dylib                   0x415b7c52 start + 2

Upvotes: 5

Views: 864

Answers (2)

ersjoh
ersjoh

Reputation: 331

After debugging this for a day, I found a workaround, even though I do not understand what's exactly happening...

After reading this (similar problem in RxSwift), I tried to disable the Dead Code Stripping build setting and then the install from TestFlight worked! As far as I can tell this looks like a Swift linker bug that is triggered somehow from my code on 32bit devices (thanks lorem ipsum for this hint!).

enter image description here

Upvotes: 2

lorem ipsum
lorem ipsum

Reputation: 29271

You need to symbolicate your .crash file so you can identify what is going on.

To symbolicate in Xcode, click the Device Logs button in the Devices and Simulators window, then drag and drop the crash report file into the list of device logs.

https://developer.apple.com/documentation/xcode/diagnosing_issues_using_crash_reports_and_device_logs/adding_identifiable_symbol_names_to_a_crash_report

Whatever it is you will probably find it in line 7. It is probably looking for some line of data that isn't available or incompatible.

Upvotes: 1

Related Questions