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")
}
}