🚨 ACTION REQUIRED — Widget build will fail unless you do this
The shared
GenericAttributes.swiftwas changed in v7.1.0.
You must re‑copy the updated file into your Widget Extension target.
Skipping this step causes mismatched types at runtime and/or compile errors.
- The plugin’s shared
GenericAttributestype (used by your widget) has been updated for push support and better initialization. - Two JS APIs now return structured objects:
isAvailable()→{ value: boolean }isRunning({ id })→{ value: boolean }
- In Xcode, open the Pods/Package tree for the plugin and locate the file:
Pods › CapacitorLiveActivity › LiveActivityPlugin › Shared › GenericAttributes.swift
Depending on your dependency manager, the path may differ slightly. Look for the Shared/GenericAttributes.swift inside the plugin.
-
Copy
GenericAttributes.swiftinto your Widget Extension target folder (e.g.LiveActivityWidget/).- In the dialog, check “Copy items if needed”.
- Under Add to targets, select your Widget Extension (not only the App target).
-
Verify the file is a member of the Widget Extension target:
- Select
GenericAttributes.swiftin the File Navigator → File Inspector (⌥⌘1) → Target Membership → ensure your Widget Extension is checked.
- Select
Why? Xcode does not automatically include files from a plugin pod/package in your widget target.
The widget must compile with the exact sameGenericAttributestype the app/plugin uses.
- Build succeeds without “cannot find type
GenericAttributes” or ambiguous type errors. - Your Live Activity renders on Lock Screen/Dynamic Island again.
- If you had runtime issues before, they disappear after re-copying.
- Compile error:
Cannot find type 'GenericAttributes' in scopein your widget files - Link/runtime mismatch (attributes/state shape not rendering as expected)
- Widget target builds against an older
GenericAttributesand UI doesn’t update correctly
Update your boolean checks to read .value:
Before
if (await LiveActivity.isAvailable()) {
/* ... */
}
if (await LiveActivity.isRunning({ id })) {
/* ... */
}After
if ((await LiveActivity.isAvailable()).value) {
/* ... */
}
if ((await LiveActivity.isRunning({ id })).value) {
/* ... */
}Optional destructuring:
const { value: available } = await LiveActivity.isAvailable();
const { value: running } = await LiveActivity.isRunning({ id });startActivityWithPush(...)— start withpushType: .token; token arrives vialiveActivityPushTokeneventobservePushToStartToken()(iOS 17.2+) — stream global push‑to‑start token vialiveActivityPushToStartTokenlistActivities()— discover activities (incl. those started via push)liveActivityUpdateevent — lifecycle notifications:active,stale,pending,ended,dismissed
- App Info.plist has:
<key>NSSupportsLiveActivities</key>
<true/>- Capabilities enabled on the App target:
- Push Notifications
- Live Activities
- The Widget Extension compiles and uses the copied
GenericAttributes.swift
- Remote pushes not showing while the app is open? That’s expected on iOS: remote Live‑Activity pushes are not delivered in foreground. Put the app in background/terminated to test remote start/update/end.
- If tokens do not appear:
- Per‑activity token: ensure you used
startActivityWithPush(...)and listen forliveActivityPushToken - Push‑to‑start token (iOS 17.2+): call
observePushToStartToken()and listen forliveActivityPushToStartToken
- Per‑activity token: ensure you used
b46b200— Push features & events (startActivityWithPush,listActivities,observePushToStartToken)bd6c937/e15f91e— Example server + structured returns (isAvailable,isRunning)12f4ccf— Tests updated and improved
Need help? Paste your error and your widget’s LiveActivityWidget*.swift snippet — we’ll map it to the exact fix.