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.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm trying to debug some connectivity issues on real devices and can't figure out how to do so. If I plug in the phone and then run that scheme it starts up. If I then switch the scheme to the watch and run, the phone debugging stops and I just have the watch.
How do I get both at once so I can see messages from each device?
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)?
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)
}
}
}