Search code examples
apple-watch

How to use Apple watch PushNotificationPayload.apns


I'm trying to understand the usage of PushNotificationPayload.apns From what I understand, I can only specify this file if running through the simulator. If that's the case, how am I supposed to receive remote notifications? Since when does the simulator support remote notifications? And even if it does, how do I get the device token from it?

Thanks


Solution

  • PushNotificationPayload.apns is indeed usable in the simulator only. It is actually useful because the Simulator does not support push notification.

    It is simply a file containing a Push Notification payload that can be used to simulate receiving a push notification on the Simulator.

    You can tell the simulator this payload should be used in your tests by editing your WatchKit App scheme, setting the Watch Interface to Dynamic or Static Notification. Then you’ll be able to specify which payload to use for the notification view.