This is a follow up to this post about building a Control Center widget to open the app directly to a particular feature. I have it working in a sample app, but when I do the same thing in my full app I get this error:
[[com.olivetree.BR-Free::com.olivetree.BR-Free.VerseWidget:com.olivetree.BR-Free.ContinueReadingPlanControl:-]] Control action: failed with error: Error Domain=ChronoKit.InteractiveWidgetActionRunner.Errors Code=1 "(null)"
Google has nothing for any of that. Can anyone shed light on what it means?
This is my control and its action:
@available(iOS 18.0, *)
struct ContinueReadingPlanControl : ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: "com.olivetree.BR-Free.ContinueReadingPlanControl") {
ControlWidgetButton(action: ContinueReadingPlanIntent()) {
Image(systemName: "book")
}
}
.displayName("Continue Reading Plan")
}
}
@available(iOS 18.0, *)
struct ContinueReadingPlanIntent : ControlConfigurationIntent {
static let title: LocalizedStringResource = "Continue Reading Plan"
static let description = IntentDescription(stringLiteral: "Continue the last-used reading plan")
static let isDiscoverable = false
static let opensAppWhenRun: Bool = true
@MainActor
func perform() async throws -> some IntentResult & OpensIntent {
let strUrl = "olivetree://startplanday"
UserDefaults.standard.setValue(strUrl, forKey: "StartupUrl")
return .result(opensIntent: OpenURLIntent(URL(string: strUrl)!))
}
}
Note also that I'm pulling this from Console.app, streaming the logs from my device. I don't know of a way to debug a Control Center widget in Xcode, though this thread implies that it's possible.