Post

Replies

Boosts

Views

Activity

performNotificationDefaultAction with SwiftUI
In my watchOS extension, I'm using the WKUserNotificationHostingController. If I override isInteractive and return true, how do I allow for opening the app? Essentially I want to know how to make the app open when tapping on specific elements of the custom View which is displayed. In previous versions I'd just call the performNotificationDefaultAction method on the WKUserNotificationInterfaceController.
0
0
812
Mar ’21
What kicks off a watchOS background URL download
I'm trying to understand the background URL download from the "Keep Your Complications Up To Date" video. I'm confused as to what the refresh method does. In his example, all it does is stores a completion handler. If schedule(first:) is what actually schedules/runs the file download, why not just pass/store the completion handler there? Seems like my applicationDidFinishLaunching method would call schedule(first: true)?
0
0
831
Jun ’21
pushRegistry(_:didUpdate:for:) never called
On my watch only app I added capabilities for Push Notifications and Background remote notifications. Then, in the App I created an instance of my provider. I see the initializer being called, but the delegate methods are never called, so I have no device token. What am I missing? import Foundation import PushKit import ClockKit final class PushNotificationProvider: NSObject {   let registry = PKPushRegistry(queue: .main)   override init() {     super.init()     registry.delegate = self     registry.desiredPushTypes = [.complication]   } } extension PushNotificationProvider: PKPushRegistryDelegate {   func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {     let token = pushCredentials.token.reduce("") { $0 + String(format: "%02x", $1) }     print(token)   }   func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) async {     // Called on the main queue based on the PKPushRegistry queue parameter.     let server = CLKComplicationServer.sharedInstance()     server.activeComplications?.forEach {       server.reloadTimeline(for: $0)     }   } }
0
0
865
Sep ’21