我已经为我的应用实现了窗口小部件扩展(即使用WidgetKit的iOS 14小部件)。通常,小部件可以正常工作,但偶尔会进入反复闪烁并最终冻结的状态。我尝试将调试器连接到小部件进程,但是它没有捕获任何崩溃或异常。但是我确实在我的设备中看到了在chronod进程中重复的崩溃(在一分钟的过程中约25次)。这些报告的外观基本相同:
Incident Identifier: ...
CrashReporter Key: ...
Hardware Model: iPhone10,3
Process: chronod [96919]
Path: /System/Library/PrivateFrameworks/ChronoCore.framework/Support/chronod
Identifier: chronod
Version: ???
Code Type: ARM-64 (Native)
Role: Unspecified
Parent Process: launchd [1]
Coalition: com.apple.chronod [443]
Date/Time: 2020-09-30 13:41:06.1434 -0700
Launch Time: 2020-09-30 13:41:05.6902 -0700
OS Version: iPhone OS 14.0 (18A373)
Release Type: User
Baseband Version: 6.02.01
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000197017d08
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [96919]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 SwiftUI 0x0000000197017d08 CodablePlatformFont.init+ 6647048 (from:) + 2744
1 SwiftUI 0x0000000197017a00 CodablePlatformFont.init+ 6646272 (from:) + 1968
2 SwiftUI 0x0000000197017d34 protocol witness for Decodable.init+ 6647092 (from:) in conformance CodablePlatformFont + 20
3 libswiftCore.dylib 0x0000000194548f80 dispatch thunk of Decodable.init+ 2957184 (from:) + 16
4 libswiftFoundation.dylib 0x0000000194162ccc __PlistDecoder.unbox<A>+ 326860 (_:as:) + 372
5 libswiftFoundation.dylib 0x000000019416d820 _PlistKeyedDecodingContainer.decode<A>+ 370720 (_:forKey:) + 660
6 libswiftFoundation.dylib 0x000000019416fc54 protocol witness for KeyedDecodingContainerProtocol.decode<A>+ 379988 (_:forKey:) in conformance _PlistKeyedDecodingContainer<A> + 48
7 libswiftFoundation.dylib 0x000000019416f9b4 protocol witness for KeyedDecodingContainerProtocol.decode<A>+ 379316 (_:forKey:) in conformance _PlistKeyedDecodingContainer<A> + 20
8 libswiftCore.dylib 0x00000001942cb2cc _KeyedDecodingContainerBox.decode<A, B>+ 344780 (_:forKey:) + 296
9 libswiftCore.dylib 0x00000001942be9e4 KeyedDecodingContainer.decode<A>+ 293348 (_:forKey:) + 40
10 SwiftUI 0x0000000197014374 CodableAttributes.init+ 6632308 (from:) + 832
11 SwiftUI 0x0000000197015170 protocol witness for Decodable.init+ 6635888 (from:) in conformance CodableAttributes + 20
12 libswiftCore.dylib 0x0000000194548f80 dispatch thunk of Decodable.init+ 2957184 (from:) + 16
13 libswiftFoundation.dylib 0x0000000194162ccc __PlistDecoder.unbox<A>+ 326860 (_:as:) + 372
14 libswiftFoundation.dylib 0x00000001941702ec _PlistUnkeyedDecodingContainer.decode<A>+ 381676 (_:) + 776
15 libswiftFoundation.dylib 0x0000000194172110 protocol witness for UnkeyedDecodingContainer.decode<A>+ 389392 (_:) in conformance _PlistUnkeyedDecodingContainer + 12
16 libswiftCore.dylib 0x00000001942d5bd0 Array<A>.init+ 388048 (from:) + 332
17 libswiftCore.dylib 0x00000001942d6178 protocol witness for Decodable.init+ 389496 (from:) in conformance <A> [A] + 28
18 libswiftCore.dylib 0x00000001942d5c8c protocol witness for Decodable.init+ 388236 (from:) in conformance <A> [A] + 20
19 libswiftCore.dylib 0x0000000194548f80 dispatch thunk of Decodable.init+ 2957184 (from:) + 16
20 libswiftFoundation.dylib 0x0000000194162ccc __PlistDecoder.unbox<A>+ 326860 (_:as:) + 372
21 libswiftFoundation.dylib 0x000000019416d820 _PlistKeyedDecodingContainer.decode<A>+ 370720 (_:forKey:) + 660
.
.
. (Shortened the stack trace for readability, lots more Plist decoding here)
.
.
153 libswiftCore.dylib 0x00000001942cb2cc _KeyedDecodingContainerBox.decode<A, B>+ 344780 (_:forKey:) + 296
154 libswiftCore.dylib 0x00000001942be9e4 KeyedDecodingContainer.decode<A>+ 293348 (_:forKey:) + 40
155 SwiftUI 0x0000000196bd0560 _ArchivedViewStates.State.init+ 2159968 (from:) + 304
156 SwiftUI 0x0000000196bd08d4 protocol witness for Decodable.init+ 2160852 (from:) in conformance _ArchivedViewStates.State + 20
157 libswiftCore.dylib 0x0000000194548f80 dispatch thunk of Decodable.init+ 2957184 (from:) + 16
158 libswiftFoundation.dylib 0x0000000194162ccc __PlistDecoder.unbox<A>+ 326860 (_:as:) + 372
159 libswiftFoundation.dylib 0x0000000194162a08 PropertyListDecoder.decode<A>+ 326152 (_:fromTopLevel:) + 344
160 libswiftFoundation.dylib 0x000000019416278c PropertyListDecoder.decode<A>+ 325516 (_:from:format:) + 296
161 libswiftFoundation.dylib 0x0000000194162658 PropertyListDecoder.decode<A>+ 325208 (_:from:) + 44
162 libswiftFoundation.dylib 0x00000001941732f4 dispatch thunk of PropertyListDecoder.decode<A>+ 393972 (_:from:) + 20
163 SwiftUI 0x0000000196bd1204 _ArchivedViewStates.state+ 2163204 (at:) + 416
164 WidgetKit 0x0000000196973ab0 0x19693a000 + 236208
165 WidgetKit 0x00000001969748d4 0x19693a000 + 239828
166 WidgetKit 0x00000001969a4794 0x19693a000 + 436116
167 ChronoKit 0x00000001b9999c34 0x1b990d000 + 576564
168 ChronoKit 0x00000001b99b3d20 0x1b990d000 + 683296
169 ChronoKit 0x00000001b99b47a0 0x1b990d000 + 685984
170 ChronoKit 0x00000001b99b4944 0x1b990d000 + 686404
171 ChronoKit 0x00000001b99b17c0 0x1b990d000 + 673728
172 SwiftUI 0x0000000196d22bdc ViewBodyAccessor.body+ 3546076 (of:) + 32
173 SwiftUI 0x0000000196ff87ac closure #1 in DynamicBody.updateValue+ 6518700 () + 156
174 SwiftUI 0x0000000196ff861c DynamicBody.updateValue+ 6518300 () + 1660
175 SwiftUI 0x0000000196d43d8c partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 3681676 (_:) + 28
176 AttributeGraph 0x00000001b6bf6064 AG::Graph::UpdateStack::update+ 20580 () + 484
177 AttributeGraph 0x00000001b6bf6474 AG::Graph::update_attribute+ 21620 (AG::data::ptr<AG::Node>, bool) + 328
178 AttributeGraph 0x00000001b6bfb678 AG::Graph::input_value_ref_slow+ 42616 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 380
179 AttributeGraph 0x00000001b6c0c258 AGGraphGetValue + 228
180 SwiftUI 0x0000000196d32cc4 SubscriptionView.ChildAttribute.view.getter + 68
181 SwiftUI 0x0000000196d32ef8 SubscriptionView.ChildAttribute.updateValue+ 3612408 () + 520
.
.
. (Shortened the stack trace for readability, lots more AttributeGraph stuff here)
.
.
222 AttributeGraph 0x00000001b6bf6064 AG::Graph::UpdateStack::update+ 20580 () + 484
223 AttributeGraph 0x00000001b6bf6474 AG::Graph::update_attribute+ 21620 (AG::data::ptr<AG::Node>, bool) + 328
224 AttributeGraph 0x00000001b6bfb678 AG::Graph::input_value_ref_slow+ 42616 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 380
225 AttributeGraph 0x00000001b6c0c258 AGGraphGetValue + 228
226 SwiftUI 0x0000000196d3da50 DynamicPreferenceCombiner.info.getter + 92
227 SwiftUI 0x0000000196d3dc00 DynamicPreferenceCombiner.value.getter + 168
228 SwiftUI 0x0000000196b2cda0 implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1490336 (_:) + 84
229 AttributeGraph 0x00000001b6bf6064 AG::Graph::UpdateStack::update+ 20580 () + 484
230 AttributeGraph 0x00000001b6bf6474 AG::Graph::update_attribute+ 21620 (AG::data::ptr<AG::Node>, bool) + 328
231 AttributeGraph 0x00000001b6bfb0f4 AG::Graph::value_ref+ 41204 (AG::AttributeID, AGSwiftMetadata const*, bool*) + 152
232 AttributeGraph 0x00000001b6c0c2a0 AGGraphGetValue + 300
233 SwiftUI 0x00000001972a5d38 GraphHost.updatePreferences+ 9325880 () + 52
234 SwiftUI 0x0000000196e32528 ViewGraph.updateOutputs+ 4658472 (at:) + 100
235 SwiftUI 0x0000000197212644 closure #1 in ViewRendererHost.render+ 8721988 (interval:updateDisplayList:) + 1316
236 SwiftUI 0x0000000197211aec ViewRendererHost.render+ 8719084 (interval:updateDisplayList:) + 316
237 SwiftUI 0x000000019735f528 _UIHostingView.layoutSubviews+ 10085672 () + 184
238 SwiftUI 0x000000019735f554 @objc _UIHostingView.layoutSubviews+ 10085716 () + 24
239 UIKitCore 0x0000000193609954 -[UIView+ 16935252 (CALayerDelegate) layoutSublayersOfLayer:] + 2464
240 QuartzCore 0x0000000193b099e8 -[CALayer layoutSublayers] + 288
241 QuartzCore 0x0000000193b0feb4 CA::Layer::layout_if_needed+ 1420980 (CA::Transaction*) + 520
242 QuartzCore 0x0000000193b1b1d0 CA::Layer::layout_and_display_if_needed+ 1466832 (CA::Transaction*) + 140
243 QuartzCore 0x0000000193a67500 CA::Context::commit_transaction+ 730368 (CA::Transaction*, double, double*) + 416
244 QuartzCore 0x0000000193a91698 CA::Transaction::commit+ 902808 () + 728
245 UIKitCore 0x00000001931217ac __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 80
246 CoreFoundation 0x0000000190844fa0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
247 CoreFoundation 0x0000000190844228 __CFRunLoopDoBlocks + 404
248 CoreFoundation 0x000000019083ea54 __CFRunLoopRun + 796
249 CoreFoundation 0x000000019083e200 CFRunLoopRunSpecific + 572
250 GraphicsServices 0x00000001a6939598 GSEventRunModal + 160
251 UIKitCore 0x0000000193104004 -[UIApplication _run] + 1052
252 UIKitCore 0x00000001931095d8 UIApplicationMain + 164
253 ChronoCore 0x00000001b92b23d4 0x1b922e000 + 541652
254 chronod 0x00000001000ab6a4 0x1000a8000 + 13988
255 libdyld.dylib 0x000000019051d598 start + 4
Thread 1:
0 libsystem_pthread.dylib 0x00000001d611b86c start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x00000001d611b86c start_wqthread + 0
Thread 3:
0 libsystem_pthread.dylib 0x00000001d611b86c start_wqthread + 0
Thread 4:
0 libsystem_pthread.dylib 0x00000001d611b86c start_wqthread + 0
Thread 5 name: com.apple.uikit.eventfetch-thread
Thread 5:
0 libsystem_kernel.dylib 0x00000001bb1a38c4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001bb1a2cc8 mach_msg + 72
2 CoreFoundation 0x000000019084474c __CFRunLoopServiceMachPort + 376
3 CoreFoundation 0x000000019083ebd0 __CFRunLoopRun + 1176
4 CoreFoundation 0x000000019083e200 CFRunLoopRunSpecific + 572
5 Foundation 0x0000000191a48278 -[NSRunLoop+ 33400 (NSRunLoop) runMode:beforeDate:] + 228
6 Foundation 0x0000000191a48158 -[NSRunLoop+ 33112 (NSRunLoop) runUntilDate:] + 88
7 UIKitCore 0x00000001931af9fc -[UIEventFetcher threadMain] + 504
8 Foundation 0x0000000191ba4c48 __NSThread__start__ + 848
9 libsystem_pthread.dylib 0x00000001d6116b70 _pthread_start + 288
10 libsystem_pthread.dylib 0x00000001d611b880 thread_start + 8
Thread 6:
0 libsystem_pthread.dylib 0x00000001d611b86c start_wqthread + 0
Thread 7:
0 libsystem_pthread.dylib 0x00000001d611b86c start_wqthread + 0
Thread 8:
0 libsystem_pthread.dylib 0x00000001d611b86c start_wqthread + 0
Thread 9:
0 libsystem_pthread.dylib 0x00000001d611b86c start_wqthread + 0
Thread 10:
0 libsystem_pthread.dylib 0x00000001d611b86c start_wqthread + 0
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x00000001000d7200 x1: 0x0000000000000407 x2: 0x0000000000000407 x3: 0x0000000100384c40
x4: 0x0000000000000020 x5: 0x0000000100384c40 x6: 0x0000000000000002 x7: 0x0000000000000000
x8: 0x091bc10038780055 x9: 0x091bc10038780055 x10: 0x00000000000bcfa0 x11: 0x0000000000003fff
x12: 0x0000000100300000 x13: 0x0000000088c5e050 x14: 0x0000000088c5e014 x15: 0x0000000000003c93
x16: 0x00000001d6106ef0 x17: 0x00000000d0411000 x18: 0x0000000000000000 x19: 0x00000001deab4d20
x20: 0x0000000000000000 x21: 0x0000000000000000 x22: 0x00000001deb92018 x23: 0x0000000100384c70
x24: 0x000000016fd4b640 x25: 0x00000001deaa3f50 x26: 0x0000000106771e00 x27: 0x0000000106771ea0
x28: 0x0000000000000000 fp: 0x000000016fd4b760 lr: 0x0000000197017a00
sp: 0x000000016fd4b630 pc: 0x0000000197017d08 cpsr: 0x60000000
esr: 0xf2000001 Address size fault
因此,很明显,该错误与解码Font对象有关。我确实在应用程序和窗口小部件中使用了可能相关的自定义字体,但是第一次在窗口小部件中显示它们时,它们显示得很好,而我的应用程序本身也没有任何问题(它不使用SwiftUI )。
看来,导致错误的过程是UI状态被编码并缓存在某个地方,然后无法解码以供稍后显示。但是这些代码都不归我所有,因此调试起来极其困难。
出了什么问题,如何解决?