XCode Version 16.0 (16A242d)
iPhone 12 - iOS 18 (22A3354)
Macbook Air M1 - Sonoma 14.6.1
I am currently working on building Control Buttons for our app and I have consistently run into the same issue:
Unknown NSError The operation couldn’t be completed. (LNActionExecutorErrorDomain error 2018.)
This error can be found in the following posts:
Apple Developer Forums - Post 1
Apple Developer Forums - Post 2
Apple Developer Forums - Post 3
I've tried every single solution recommended within these posts, however nothing has worked successfully so far.
Additionally, I've tried the using .widgetUrl() on the Label() within the ControlWidgetButton like so:
ControlWidgetButton(action: JournalControlIntent()) {
Label("Open App", systemImage: "pencil.line")
.widgetURL(URL(string: "app://control/page"))
}
But this did not work either.
Using the recommended approach to open the app as seen here: https://developer.apple.com/documentation/widgetkit/creating-controls-to-perform-actions-across-the-system#Open-your-app-with-a-control
simply won't work since we have a Flutter app with deep linking setup. Meaning the only option is launching either a deep link or universal link. Our URL scheme is setup correctly since it's currently working for our iOS Widgets & Shortcuts(which use widgetURL & openURL).
In Post 3, the accepted answer mentions that the control file must have the Target Membership with the App and Widget Targets to work. When I try using this solution the build fails without any errors(until you run it in VSCode where there are many errors about Derived Data - Deleting the derived data doesn't fix this error)
I'm wondering if I have added the Control Widget to the incorrect folder within my XCode project? Since if you use the approach of creating a Control through XCode(File > New > Target > Widget Extension > "Include Control" > Next) it creates a top level directory in the project similar to a Stickers or Watch extension.
My Control Widgets currently reside in the [App] Widgets > Control Buttons > Control Button.swift. It's then added to my main widget definition(App Widget > App_Widget.swift):
@main
struct App_Widget: WidgetBundle {
var body: some Widget {
App_Widget() // works
App_Widget_One() // works
if #available(iOSApplicationExtension 18.0, *) {
ControlButtonOne() // does not open app
ControlButtonTwo() // does not open app
}
}
}
Thank you for your help and time!