Naveen George Thoppan Naveen George Thoppan - 4 months ago 14
iOS Question

Firing apple watch notification

I've a todo app and I need a notification to be displayed to the watch at the scheduled todo time. How do I do this? I've read that iOS local notification automatically fires notification in the watch. Is it possible? If yes, do I need to add any code in extra to do so?


The concept of a UILocalNotification hasn't changed with WatchKit. The only thing that has changed is that iOS can now decide whether to send a local (or remote) notification to either the iPhone or the Watch. There is no programmatic way to control which of these devices actually displays the notification, though.

To schedule a UILocalNotification from a WatchKit app requires using something like the openParentApplication:reply: class method on WKInterfaceController to have the iPhone app do the actual scheduling. This is because WatchKit doesn't have access to UIApplication, the class that is used to schedule local notifications.