I have today extension and in production reports, I can see a lot of crashes:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Backtrace:
Last Exception Backtrace:
0 CoreFoundation 0x1a4043d04 __exceptionPreprocess + 164 (NSException.m:202)
1 libobjc.A.dylib 0x19d1683d0 objc_exception_throw + 60 (objc-exception.mm:356)
2 CoreFoundation 0x1a41b8ac8 -[NSObject(NSObject) doesNotRecognizeSelector:] + 136 (NSObject.m:140)
3 CoreFoundation 0x1a405a138 ___forwarding___ + 1592 (NSForwarding.m:3578)
4 CoreFoundation 0x1a40c0950 _CF_forwarding_prep_0 + 96
5 MyAppWidgetExtension 0x1006f523c MyWidgetProvider.getTimeline(for:in:completion:) + 80 (MyWidget.swift:48)
6 WidgetKit 0x1b151aa9c closure #1 in IntentTimelineEntryProvider.timeline(for:with:completion:) + 432 (IntentConfiguration.swift:285)
7 WidgetKit 0x1b143460c thunk for @escaping @callee_guaranteed () -> () + 36 (<compiler-generated>:0)
8 libdispatch.dylib 0x1ab509320 _dispatch_call_block_and_release + 32 (init.c:1518)
9 libdispatch.dylib 0x1ab50aeac _dispatch_client_callout + 20 (object.m:560)
10 libdispatch.dylib 0x1ab5196a4 _dispatch_main_queue_drain + 928 (queue.c:7794)
11 libdispatch.dylib 0x1ab5192f4 _dispatch_main_queue_callback_4CF + 44 (queue.c:7954)
12 CoreFoundation 0x1a40d2c78 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
13 CoreFoundation 0x1a40b45b0 __CFRunLoopRun + 1992 (CFRunLoop.c:3147)
14 CoreFoundation 0x1a40b943c CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
15 Foundation 0x19e3bf0c4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
16 Foundation 0x19e3bef58 -[NSRunLoop(NSRunLoop) run] + 64 (NSRunLoop.m:398)
17 libxpc.dylib 0x203b75678 _xpc_objc_main + 496 (main.m:246)
18 libxpc.dylib 0x203b77924 xpc_main + 156 (init.c:1258)
19 Foundation 0x19e406ac0 -[NSXPCListener resume] + 312 (NSXPCListener.m:460)
20 ExtensionFoundation 0x1b173e658 -[_EXRunningExtension resume] + 204 (EXRunningExtension.m:250)
21 ExtensionFoundation 0x1b173e4f0 -[_EXRunningExtension startWithArguments:count:] + 188 (EXRunningExtension.m:228)
22 ExtensionFoundation 0x1b175e520 EXExtensionMain + 220 (EXExtensionMain.m:31)
23 Foundation 0x19e44af80 NSExtensionMain + 204 (NSExtensionMain.m:21)
24 dyld 0x1c3cdfdec start + 2220 (dyldMain.cpp:1165)
Kernel Triage:
VM - (arg = 0x0) pmap_enter retried due to resource shortage
The line with crash is indicated as this:
func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline<Entry>) -> Void) {
let configurationStep = configuration.step?.step ?? .unknown <-- there is a crash
....
ConfigurationIntent is auto generated class
@available(iOS 12.0, macOS 11.0, watchOS 5.0, *) @available(tvOS, unavailable)
@objc(ConfigurationIntent)
public class ConfigurationIntent: INIntent {
@NSManaged public var step: DataStep?
@NSManaged public var additionalInformation: AdditionalInformation
@NSManaged public var source: Source
@NSManaged public var location: InLocation?
}
@available(iOS 12.0, macOS 11.0, watchOS 5.0, *) @available(tvOS, unavailable)
@objc(WeatherStep)
public class DataStep: INObject {
@available(iOS 13.0, macOS 11.0, watchOS 6.0, *)
@NSManaged public var step: DataStepType
override public class var supportsSecureCoding: Bool { true }
}
And DataStepType have custom extension
extension DataStepType {
var apiDataStep: APIDataStep {
switch self {
case .daily:
return APIDataStep.day
case .threeHours:
return APIDataStep.threeHours
default:
return APIDataStep.hour
}
}
}
I have no problems in debug and not all users experience this problem. What can be the cause?