SwiftUI Apple Watch 应用程序在发布版本时崩溃(仅限系列 3)

标签 swift swiftui watchkit apple-watch combine

我有一个非常奇怪的崩溃,仅在发布版本(App Store + TestFlight)和 Apple Watch Series 3 上发生 如果我在我的系列 3 上调试时运行它,它工作正常。在较新的 watch (系列 4+)上,App Store 和调试版本运行良好。
我的 watch 应用使用 SwiftUI。有人知道这里发生了什么吗?这是 SwiftUI 错误还是我做错了什么?
这是我从系列 3 中得到的崩溃日志(符号):

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

最佳答案

在调试了一天之后,我找到了一个解决方法,即使我不明白到底发生了什么......
阅读后this (RxSwift 中的类似问题),我尝试禁用 Dead Code Strippingbuild设置,然后从 TestFlight 安装工作!据我所知,这看起来像是一个 Swift 链接器错误,它是从我的 32 位设备上的代码中以某种方式触发的(感谢 lorem ipsum 提供此提示!)。
enter image description here

关于SwiftUI Apple Watch 应用程序在发布版本时崩溃(仅限系列 3),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64335093/

相关文章:

arrays - Swift:属性名称的插值?

swift - SuperpoweredAdvanceAudioPlayer 可以从 Swift 调用吗?

SwiftUI 有条件地定义 NavigationLink 目的地

swift - SwiftUI 列表的性能问题

ios - 显示来自服务器的更新数据的 watch 套件

swift - 无法添加从 Button 到 ViewController 的 Outlet 连接

ios - Swift 数组语法

ios - 无法将类型 [Type] 的值转换为预期的参数类型 'some View'

ios - 未在运行WatchOS2的Apple Watch中模拟电话

ios - 如何在 Apple Watch 上部署(构建和运行)应用程序?