I'm trying to implement push notifications to update Control Center Widget as described here:
I've made my handler
import WidgetKit
import CommonTools
@available(iOSApplicationExtension 18.0, *)
struct ControlCenterPushHandler: ControlPushHandler {
func pushTokensDidChange(controls: [ControlInfo]) {
print("pushTokensDidChange called. \(controls)")
controls.forEach{
print("ControlInfo \($0)")
}
}
}
And registered it for my controls
var body: some ControlWidgetConfiguration {
AppIntentControlConfiguration(
kind: WidgetConfig.Constants.controlCenterLock,
provider: Provider()) { value in
ControlWidgetToggle(
"Lock/Unlock",
...
}
.pushHandler(ControlCenterPushHandler.self)
}
}
and then run my software on an iPhone 15 pro running iOS 18 developer beta 7.
pushTokensDidChange is not called as I add and remove controls from the control panel. Or ever for that matter.
If I inspect push tokens when my currentValue code runs
struct Provider: AppIntentControlValueProvider {
func currentValue(configuration: ControlCenterButtonConfiguration) async throws -> Value {
let controls = try await ControlCenter.shared.currentControls()
controls.forEach{
print("ControlInfo \($0)")
}
pushInfo is always nil
ControlInfo ControlInfo(kind: "ControlCenterLock", pushInfo: nil, control:...
What steps are needed to get a push token?