Search code examples
iosobjective-cios9watchkitxcode7.2

Watch-kit : adding "Notifications Scene" to existing watchkit app ios


  • I have created an iOS app then i added new Watch-kit app target without notifications scene.

  • Previously i did not need to show notifications.But now i want to add notifications scene also.i want to add "Notifications Scene" in my existing Watch-kit app.

  • Will i have to create new target ? or i will have to add notifications classes and interface file manually?

I have searched on SO and other developers forums , i did not get any satisfactory answer.


Solution

  • No you do not have to create another target to handle notifications. All you need to do is to add the Notification Interface Controller object to your Interface.stroyboard file plus a .apns file you need to create which would have been created by Xcode if you have selected the option during project creation.

    Add a Notification Interface Controller object from object library and select the option Has Dynamic Interfaces if you are implementing a dynamic notification scene. This will add another scene automatically to your stroyboard.

    Check the Apple Documentation for details and Tutorial to set up remote notification in Watch App. Though the tutorial doesn't add the notification scene separately but you will get the idea https://www.natashatherobot.com/watchkit-actionable-notifications