I am trying to add more than one ControlWidget in iOS 18 and I get an error and not sure whether I am doing anything wrong or there is a bug (or maybe it's not supported by design?)
I get the following error:
encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget 'check.ios18-test.intent-ext-ui' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x600000cb7060 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=2 "Please specify the widget kind in the scheme's Environment Variables using the key '_XCWidgetKind' to be one of: "
These are the two ControlWidgets I am trying to create:
struct GetPointIntent: AppIntent {
static let title: LocalizedStringResource = "Get Point"
func perform() async throws -> some IntentResult {
return .result()
}
}
struct LeftButton: ControlWidget {
static let kind: String = "check.ios18-test.left"
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: Self.kind) {
ControlWidgetButton(action: GetPointIntent()) {
Label("Plus", systemImage: "arrowshape.left")
Text("\(AppState.points)")
}
}
.displayName("Left")
.description("Left Move")
}
}
struct RightButton: ControlWidget {
static let kind: String = "check.ios18-test.right"
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: Self.kind) {
ControlWidgetButton(action: GetPointIntent()) {
Label("Plus", systemImage: "arrowshape.right")
}
}
.displayName("Right")
.description("Right Move")
}
}
@main
struct intent_ext_uiBundle: WidgetBundle {
var body: some Widget {
RightButton()
LeftButton()
}
}
The app builds but upon running I get the mentioned error from Xcode