I have an app for Apple Watch as a companion app for an iPhone app. The local notifications on Apple Watch App are delayed. I scheduled a local notification to be fired after 10 seconds. When I press the button on the watch that creates the notification and I exit the app, it doesn't take 10 seconds to display the notification but about 23 seconds.
I created a test stand alone/independent Apple Watch App with the same local notification code, and in this scenario, the local notification fires at the correct time.
I am on watchOS 8.1. Is this a new feature on Apple Watch or a bug? Because on iPhone it works without any delay. Thank you in advance :)
// Configure the notification's payload.
let content = UNMutableNotificationContent()
content.title = "Drink some milk!"
content.subtitle = "you have 10 sec"
content.sound = .default
content.categoryIdentifier = "myCategory"
let category = UNNotificationCategory(identifier: "myCategory", actions: [], intentIdentifiers: [], options: [])
UNUserNotificationCenter.current().setNotificationCategories([category])
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 10, repeats: false)
let request = UNNotificationRequest(identifier: "milk", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request) { (error) in
if let error = error{
print(error.localizedDescription)
}else{
print("scheduled successfully")
}
}
-
—
marsuda
-
—
marsuda
Add a CommentSame issue here, WatchOS 8.3. What's even funnier, same code runs fine on one of my apps (standalone app), but not the other (well, also standalone but bundled with an iPhone app). The code runs fine on watch simulator and iPhone but on a real device there's a delay.
Upon searching here and there, it seems that the bug would come and go every so often (introduced WatchOS 6 or before, fixed WatchOS 6.1), even the delay matches (10, 13, up to 15 seconds) "historical data".
Checked my release. Funnily enough, when I uninstall iPhone version (as I mentioned, bundled but standalone) the notifications on the Watch start to arrive precisely on time.