I created an app for Apple Watch with a companion app for iPhone. These two apps test the local notifications on both devices.
But since I updated to iOS 13.1.2 and WatchOS 6.0.1, the local notifications on Apple are delayed: when I press the button on the watch that creates the notification and I exit the app, it doesn't take 5 seconds to display the notification but about 20 seconds... when I change the code to 3 seconds it takes 16 secs to display.
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 = NSString.localizedUserNotificationString(forKey: "Hello!", arguments: nil)
content.body = NSString.localizedUserNotificationString(forKey: "Hello_message_body", arguments: nil)
content.sound = UNNotificationSound.default
// Deliver the notification in five seconds.
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
let request = UNNotificationRequest(identifier: "FiveSecond", content: content, trigger: trigger) // Schedule the notification.
let center = UNUserNotificationCenter.current()
center.add(request) { (error : Error?) in
if let theError = error {
// Handle any errors
}
}
EDIT:
I also noticed this strange behavior: when I create a notification on iPhone, pressing the button and then put the phone on stand by so the notification gets delivered to Apple Watch, the notifications gets displayed correctly after 5 seconds on the watch!
I've just updated my Apple Watch to WatchOS 6.1 and yes... they fixed the bug!!! Now the notifications created locally get triggered on time :)