SimulatorRemoteNotifications
SimulatorRemoteNotifications is an iOS library to send (fake) remote notifications to the iOS simulator.
The library extends UIApplication by embedding a mini server that listen for udp packets containing JSON-formated payload.
Note that SimulatorRemoteNotifications does not send notification through Apple's Push Service.
Usage
In your iOS project:
- Add the SimulatorRemoteNotifications directory into your project.
- Add
#import "UIApplication+SimulatorRemoteNotifications.h"
to your application delegate. - Add
[application listenForRemoteNotifications];
to application:didFinishLaunchingWithOptions:
Optional: you can set the port by calling setRemoteNotificationsPort:
The default port number is 9930
To send a remote notification, send an udp packet to localhost:9930. You can do this from the terminal by using netcat:
echo -n '{"message":"message"}' | nc -4u -w1 localhost 9930
Example
You can look at SimulatorRemoteNotificationsExample.xcodeproj and run the example project.
Note
(Real) Apple remote notifications are limited to 256 bytes content length.