No. This use does not seem to be possible. You can add a deep-link to your "to battle!" button to open the app to the battle screen but that's just about the limit of interactivity you can achieve with widgets.
Post
Replies
Boosts
Views
Activity
Answering my own question: This works just fine. Here is a great tutorial on how to use URLSessions in widgets. (tl;dr: no special considerations necessary) (This does not allow me to link the URL but search for Oliver Binns WidgetKit)
In my case the problem was because with data from the network, my widget was running against the 30MB memory limit.
TimelineProvider now has placeholder(with: Context).
This seems to be a bug. I created a new Xcode project and added a WidgetKit extension with ConfigurationIntent. Still does not work.
You cannot use UIKit views in WidgetKit. Your widgets need to use pure SwiftUI because the timeline entries get serialized.
Did you try using the normal .blur() view modifier?
You should look into:
if #available(iOS 14.0, *) {
WidgetCenter.shared.reloadAllTimelines()
}
Answering my own question:
Xcode was auto-resolving WidgetKit and implicitly adding it as a required framework. Adding it manually as an optional framework fixed the issue.
Hope this helps somebody.
Beta 4 seems to have fixed this issue.
Answering my own question hoping it will help somebody else in the future:
Make sure you specify the bundle argument in NSLocalizedString. Otherwise it will default to Bundle.main. You need to use the bundle of your shared framework for the correct strings to be used.
Same here. Tried setting build numbers manually and creating a brand new workflow. Nothing helped.
After many attempts trying to figure out what was going on, I was able to resolve this by modernizing the project structure:
Getting rid of the two single platform targets building the SolarKit framework in favor of splitting the SolarKit framework into two multi-platform frameworks which build on top of each other: CoreSolarKit for the basic functionality with watchOS support and ExtendedSolarKit which does not support watchOS.
Converting the watch app target to a single watch app instead of old fashioned app+extension.
Ensuring all target dependencies are explicit and that the app targets correctly bundle the correct non-system frameworks.
I hope this helps somebody.
Specifically, the crash reports on device say:
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: RUNNINGBOARD 0
and the stack trace is all system code. It seems like my extension is getting terminated for some reason but I don't know why.
I dug around and found this in Console:
[xpcservice<com.fifteenjugglers.solarwatch.SolarARCamera([osservice<com.apple.SpringBoard>:34])>{vt hash: 120182604}:2718] Terminating with context: <RBSTerminateContext| explanation:LockedContentServices deleting contents of extension data container reportType:None maxTerminationResistance:Interactive attrs:[
<RBSPreventLaunchLimitation| <RBSProcessPredicate <RBSProcessBundleIdentifierPredicate "com.fifteenjugglers.solarwatch.SolarARCamera">> allow:(null)>
]>
Also it seems like the UI loads correctly if I remove the ARSCNView which renders the solar path from my camera UI.
For future reference, this is the same issue as https://developer.apple.com/forums/thread/759290?parentId=794962022#794962022
The following seems to work on both iOS 17 and iOS 18
var body: some Widget {
if #available(iOSApplicationExtension 18.0, *) {
return iOS18Widgets
} else {
return iOS17Widgets
}
}
@WidgetBundleBuilder
var iOS17Widgets: some Widget {
LiveActivityWidget()
HomeScreenWidget()
LockScreenWidget()
}
@available(iOSApplicationExtension 18.0, *)
@WidgetBundleBuilder
var iOS18Widgets: some Widget {
LauncherControl()
LiveActivityWidget()
HomeScreenWidget()
LockScreenWidget()
}