How can I test Apple Push Notification Service without an iPhone? How can I test Apple Push Notification Service without an iPhone? ios ios

How can I test Apple Push Notification Service without an iPhone?


This answer is outdated. As of 2020 / Xcode 11.4 it's now possible to test push notifications in the simulator

See this full explanation in an answer below

Sorry to say, but you'll need to find some hardware to test this functionality.

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. That also means you'll probably have to be accepted into the apple iPhone developer program and pay your $99.

On the bright side, with the iPhone OS 3.0 update, you can test this functionality on any device, including the first gen iPhones.


You can't test real push notifications. However, you can test your app's response to a simulated push notification by creating one programmatically and manually triggering your AppDelegate's - application:application didReceiveRemoteNotification:notification method.

To trigger this from a different class (like a UIViewController):

[[[UIApplication sharedApplication] delegate]                    application:[UIApplication sharedApplication]   didReceiveRemoteNotification:testNotification];

The testNotification should have the same format as a real notification, namely an NSDictionary that contains property list objects plus NSNull.

Here's an example of how to provide the testNotification above:

NSMutableDictionary *notification = [[NSMutableDictionary alloc] init];[notification setValue:@"Test" forKey:@"alert"];[notification setValue:@"default" forKey:@"sound"];NSMutableDictionary *testNotification = [[NSMutableDictionary alloc] init];[testNotification setValue:notification forKey:@"aps"];

This should create a reasonable notification NSDictionary to work with.


Nowadays, we can test push notifications with this library.

It's pretty easy to send push via terminal:

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