Hi,
I'm playing with the new UserNotification framework. On the iPhone, in iOS 10, mostly everything works great up until now and I have to say that I love this framework. On watchOS 3 on the other hand, it seems to be problematic. For example, a scheduled notification runs just once, after that it just doesn't get triggered anymore. Anyone else having this issue? Any workarounds for the time being?
The code I use is straightforward. (code that works on iOS 10 without any problems btw):
@IBAction func notifyButton() {
let content = UNMutableNotificationContent()
content.title = "Nice title"
content.body = "Great body... "
content.sound = UNNotificationSound.default()
/
let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 5, repeats: false)
let request = UNNotificationRequest.init(identifier: "id", content: content, trigger: trigger)
/
let center = UNUserNotificationCenter.current()
center.add(request) { (error) in
print(error)
}
}
(the requestAuthorization procedure is handled elswhere)
Tapping the button (and pushing the app to the background) delivers a notification in 5 secs. This only works the first time the app is installed on a simulator or actual watch. After that, tapping the button doesn't do anything. Even when I kill the app and relaunch it it doesn't work.