Testing apple push notifications on iOS simulator

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.

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

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

 

 
Dost Muhammad Shah

Dost Muhammad Shah

Dost Muhammad specializing in Embedded Design, Firmware development, PCB designing , testing and prototyping. He enjoys sharing his experience with others .Get in touch with Dost on Twitter or via Contact form

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.