Testing apple push notifications on iOS simulator


Leave a comment  →

You can not send / receive apple push notifications on iOS simulator as Push notifications are not available in the simulator. They require a provisioning profile from iTunes Connect, and thus are required to be installed on a device.

In order to test your app’s response to a push notification you either have to use a real device or you may use a library called SimulatorRemoteNotifications.

SimulatorRemoteNotifications is a library to send mock remote notifications to the iOS simulator.

It’s pretty easy to send push via terminal:

echo -n '{"message":"message"}' | nc -4u -w1 localhost 9930
echo -n '{"aps":{"alert" : "message","badge" : 99,"sound" : "default"}, "myField" : 54758}'

The library extends UIApplication by embedding a mini server that listen for UDP packets containing JSON-formated payload, and a service to send notifications to the mini server. It also includes the iOS Simulator Notifications MacOSX app to help you send the mock notifications.

RECOMMENDED READ  upload/downlaod file from FTP using AT commands (Sim900 + arduino)

Note that SimulatorRemoteNotifications does not send notification through Apple’s Push Service.

More details at https://github.com/acoomans/SimulatorRemoteNotifications

 

Leave a Reply