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

Is it possible to test Apple Push Notification Services without an iPhone app? (Creating an emulator on windows?)

If this is not the case, how can I check it? Is there a free sample application compiled for this?

I created a server provider, but I need to test the functionality.

+47
iphone apple-push-notifications
Jul 03 '09 at 19:26
source share
5 answers

Sorry, but you 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 therefore must be installed on the device. It also means that you may have to participate in the Apple iPhone Developer Program and pay $ 99.

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

+62
Jul 04 '09 at 20:19
source share
โ€” -

You cannot test real push notifications. However, you can test your applicationโ€™s response to a simulated push notification by creating one programmatic and manual launch of your AppDelegate method - application:application didReceiveRemoteNotification:notification .

To initiate this from another class (e.g. UIViewController):

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

TestNotification must be in the same format as the real notification, namely NSDictionary containing the properties list objects plus NSNull.

Here is an example of how to provide 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 NSDictionary notification to work with.

+43
Dec 13 '12 at 17:48
source share

We can currently test push notifications using this library .

It is very easy to send push through the terminal:

 echo -n '{"message":"message"}' | nc -4u -w1 localhost 9930 echo -n '{"aps":{"alert" : "message","badge" : 99,"sound" : "default"}, "myField" : 54758}' | nc -4u -w1 localhost 9930 
+26
Jul 15 '13 at 6:43
source share

The simulator does not support Push Notifications.

And in order to click from the server, you must have the device (s) that you need to click, as well as your application on this device.

The token contains the application identifier as well as the device identifier.

+5
Aug 17 '09 at 16:23
source share

you should use

 NSString *notificationString = @"{\"aps\":{\"alert\":\"Test alert\",\"sound\":\"default\"}}"; NSData *notificationData = [notificationString dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary *testNotification = [NSJSONSerialization JSONObjectWithData:notificationData options:0 error:&error]; [[[UIApplication sharedApplication] delegate] application:[UIApplication sharedApplication] didReceiveRemoteNotification:testNotification fetchCompletionHandler:nil]; 
+3
Jul 01 '14 at 15:19
source share



All Articles