Xcode 16, iOS 18 official release. On both my phone and simulator, when I build the release build of my app, when I go to control center and select "Add a Control", springboard crashes (see attached crash log).
Somehow this does not happen in debug config, with debug config (which does have a different bundle ID but everything else is the same) I'm able to add the control widget just fine.
The widget code is taken directly from the Apple docs:
struct WidgetTestWidgetControl: ControlWidget {
static let kind: String = "com.myapp.WidgetTestWidget"
var body: some ControlWidgetConfiguration {
AppIntentControlConfiguration(
kind: Self.kind,
provider: Provider()
) { value in
ControlWidgetToggle(
"Start Timer",
isOn: value.isRunning,
action: StartTimerIntent(value.name)
) { isRunning in
Label(isRunning ? "On" : "Off", systemImage: "timer")
}
}
.displayName("Timer")
.description("A an example control that runs a timer.")
}
}
extension WidgetTestWidgetControl {
struct Value {
var isRunning: Bool
var name: String
}
struct Provider: AppIntentControlValueProvider {
func previewValue(configuration: TimerConfiguration) -> Value {
WidgetTestWidgetControl.Value(isRunning: false, name: configuration.timerName)
}
func currentValue(configuration: TimerConfiguration) async throws -> Value {
let isRunning = true // Check if the timer is running
return WidgetTestWidgetControl.Value(isRunning: isRunning, name: configuration.timerName)
}
}
}
struct TimerConfiguration: ControlConfigurationIntent {
static let title: LocalizedStringResource = "Timer Name Configuration"
@Parameter(title: "Timer Name", default: "Timer")
var timerName: String
}
struct StartTimerIntent: SetValueIntent {
static let title: LocalizedStringResource = "Start a timer"
@Parameter(title: "Timer Name")
var name: String
@Parameter(title: "Timer is running")
var value: Bool
init() {}
init(_ name: String) {
self.name = name
}
func perform() async throws -> some IntentResult {
// Start the timer…
return .result()
}
}
However in a fresh project I am able to add this widget code and it works completely fine in both debug and release. How can I fix this?
This is clearly affecting many apps and is the 'fault' of the app, see these threads: https://www.reddit.com/r/ios/comments/1fiqrd7/ios_18_control_center_keeps_crashing_when_trying/ https://discussions.apple.com/thread/255759997?sortBy=rank