How to test Push Notification is working in my app

2019-01-31 00:25发布

问题:

In my application I am implementing the Push Notification Service.
I have a Content Provider server, which contains some products in it.
I have generated the SSL Client Certificate and attached it to my development Provisioning profile. This profile is also added to my application.
I have written the code inside the delegate methods (guided by Apple guideline for implementing the Push Notification). All set.

Now I want to test my application whether it is handing the push notification as per the requirement. Any idea on how can I test it would help me a lot.
Should I have to add new product to the content provider server to test this?

If yes, how much will APNS take to send the push notification to my device?

回答1:

Very cool guide is posted here: Programming Apple Push Notification Services

And an application here: PushMeBaby Mac Os App which you can download and use for sending push-notifications to your devices from a Mac.

APNS will send the push notification to your device as soon as your device will become available. If I'm not mistaken your device pings APNS every minute.



回答2:

I tried all 3 of the above suggestions with no success. In case someone else is ends up here looking for a solution to this, I found this and it works great:

Pusher https://github.com/noodlewerk/NWPusher



回答3:

You should try the the branch of PushMeBaby, it worked for me.



回答4:

What about curl:

curl -d '{"aps":{"alert":"This is a test notification"}}' --cert YourCertificate.pem:YourPassword -H "apns-topic: com.example.yourapp" --http2  https://api.development.push.apple.com/3/device/YourDeviceToken

First you need curl with http2 support.
And you need to convert your push certificate to pem format using openssl.



回答5:

Try this online application, through which you could paste in your device token and provide the certificate, and so send push notification to any devices and lets you customize the data as well. http://pushmebaby.herokuapp.com



回答6:

If you want to support both Certificate and Token based authentication with APNS, then you can try Push Notifications



回答7:

You can use APNS tester,its a very good tool for test APNS from Mac Machine link to download this software. 2 things you need to provide to test push notification

1.APNS certificate (.cer file) 2.Device token of user's iOS device



回答8:

PushMeBaby is frozen when I test iOS10 in Xcode8. Try NWPusher, https://github.com/noodlewerk/NWPusher. A friendly and simple tool with GUI.



回答9:

If you google you will see a number of websites that do this. I usually use https://www.apnstester.com and https://www.pushty.com