While creating push notifications certificate, I can see two options:
Apple Push Notification service SSL (Sandbox)
Apple Push Notification service SSL (Sandbox & Production).
If I can use Apple Push Notification service SSL (Sandbox & Production) for both production and staging environments. Why do I need Apple Push Notification service SSL (Sandbox) certificate? Why still I require this option?
I have another question related to this. I'm delightful if anyone answers it.
Is creating push notifications certificate from APP IDs Configurable Section and Certificates Section same? (If it's same, creating production push certificate from APP IDs section will create Apple Push Notification service SSL (Sandbox & Production) or Apple Push Notification service SSL (Production) only?)
Lets suppose you want to test sending batch notifications from your external server to APNS. Which certificate would you like to test it on? Remember you don't want your live users to receive multiple test push notifications.
Also, lets suppose you want to test some third party server functionality of sending test notifications but you are still not in contract with them. Do you want to provide your Production certificate to them?
Related
I have been tasked with maintaining an iOS app with push notifications enabled. There is a production "Apple Push Notification service SSL Certificate" associated with the app's Identifier on developer.apple.com that expires soon. Also, under Keys there is a key with the Apple Push Notifications service (APNs) enabled. It appears that the backend server sending out the push notifications is only using this key and not the certificate.
Is it safe to let the Apple Push Notification service SSL Certificate expire? And what problems might occur if the certificate turns out to be in use somewhere?
in my experience, you app stop receive push notification.
And wait you client to complaint about this. You must renew APns Certificate and voip certificate every year.
I am trying to determine what I need to do with respect to the combination of APNS endpoint (e.g., development or production), Xcode, and Apple Push certificates in order to test push notifications while in development. I feel like I've tried every possible combination, but I must be missing something ...
Background
When using Apple's HTTP/2 APNS endpoints from my "dispatch" server, my app/device does not receive pushes, and I receive a BadDeviceToken response from Apple.
Using the exact same .p12 certificate and deviceToken with the Pusher macOS testing app (which uses legacy APNS endpoints), the pushes successfully deliver.
To complicate this further ...
When using Apple's HTTP/2 APNS endpoints from my "dispatch" server for PassKit pushes, my pass/device does receive pushes.
So ...
Point #3 tells me that my "dispatch" server must be configured properly, because pushes to the Apple Wallet pass cause a response (e.g., I can see follow-on requests to my server's endpoints from the Wallet / the pass).
That said, Apple Wallet is a "Production" app. I suspect that, because my app (from Point #1) is non-production/development, something is different.
.
Question
Has anyone been able to successfully receive -- in Xcode -- push notifications sent to Apple's api.development.push.apple.com endpoint? Can you outline the steps you performed (which certificate from developers.apple.com, etc.)? Thank you!
You should be able to send development push from server:
You need to connect to api.development.push.apple.com:443 instead of api.push.apple.com:443. You can use production certificate for both.
Sending push to production server can not work with development builds - only with a build that is exported with AppStore configuration, but you can't debug those (at least not with Xcode)
If you need to check whether the production endpoint works, you can use testflight
Set development certificate from apple developer portal.
Use either production/test server for communicating with APNS.
Edit your target scheme as follows :
This will ensure that when push notification arrives, control will itself fall in the code. It might seem confusing. But here it is how it works :
- Install app on device and stop the Run process from Xcode.
- Place a breakpoint on didReceiveRemoteNotification.
- Send a push notification to device.
- Xcode will itself start the app and control will go to the above function.
I'm trying to test Push Notifications on an app which has been developed by other team. We have the app installed in our device and validated (the app is no yet in the App Store).
Connection parameters with APNS server are ok.
We launch our script to execute the Push Notification but we don't receive any notification in our device/app.
Question:
There are any log or trace in APNS of our demands?
Have APNS any history of the Notifications sended and its status ?
Note : We use Adobe Campaign to generate Push Notifications services.
We've tested the flux with an alpha version of the app and worked but now with a RC candidate doesn't work.
Thanks in advance
I recommend to check all these possibilities:
Notification is not sent from server
Try to log apns response to see if this is the issue
Check if apple certificates used are expired
Check if you're sending notification using development or production certificates with the right gateway. As Apple say:
The binary interface of the production environment is available through gateway.push.apple.com, port 2195; the binary interface of the development environment is available through gateway.sandbox.push.apple.com, port 2195.
Notification is sent from server but is not received by device
Check in settings if push notification are enabled for your app
Check if some code is hiding the notification when the app is in foregroud or is working in background
Check if you have installed the right environment application (if you send notification for production you won't receive nothing in a development build of the app)
Check the device token used to send notification
Did your app communicate to your server that it is a staging app and that the script should send APN via the Apple staging server?
Did you also deploy staging certs/keys to your server?
Did you log the response you got from the APN server when your server communicated with it?
Use APN Tester app save my day, thanks "sanandiya viper".
The problem was app's developers don't tell us p12 certificate is production one and we installed it as developer certificate. APN Tester bring us the choice to test booth options.
Thanks for all your answer. Problem solved.
The apple documentation mentions there is no restriction on multiple provider notifications servers to send push notification to iOS devices.
Is it possible, the same device token can be used in two different provider servers deployed in 2 different network,to send push notifications to same app at any moment.
Will Apple APNS, allow 2 different provider servers, use same device key to send notification from each to same app in one device?
Yes you can have multiple Gateways (SNS, Urban Airship, PushIO, etc.) connected to one platform provider (APNS, GCM, Amazon, etc.), the most important thing is the token/registration ID (specific to a device and an Application) and the certificate if you are using APNS.
Many people ask how the feedback sent by the platform provider is handled in this case.
Since feedback is idempotent, it should work without problem for different gateways; tokens saved on each Gateway can be handled in the backend application. If for example APNS sends a feedback to SNS saying that an endpoint is no longer valid (maybe because the user has uninstalled the Application), the token can directly be updated/removed from all the other Gateways. You can also leave it as it is and wait for the feedback sent by APNS to other gateways when they send notifications to the endpoint, and then update your endpoints list accordingly in those gateways.
The most important thing to note here is that feedback is idempotent, if SNS sends a push notification to an endpoint and receive a feedback, another gateway that sends a push notification to the same token will receive the same feedback.
This is my experience while working with APNS, this is like a checklist, before you start testing notification in any environment,
Certificates will decide server can connect to APN or not.
According to the certificate you have for ex. dev certificate or production
certificate, point to respective APNS sandbox.
Production Sandbox:-
Hostname: gateway.push.apple.com ,
Port: 2195
Development environment:-
Hostname: gateway.sandbox.push.apple.com ,
Port: 2195
There is no restriction that production certificate can be used in only one server or in only one network. The same production certificate can be used in multiple boxes or multiple networks to send notification to same app on a device.
Most important is checking Firewall is blocking connectivity from your network to APNS Dev or Production. So do a telnet to both production and dev environment APNS. The connection should not be blocked.
If firewall is blocking connectivity to APNS, the server code will throw "Connection Refused" or "Connection Closed" exception while sending push notification.
This is the most weird behavior I saw with APNS and certificate, because of which I lost 2-3 days. I experienced below depending upon the case,
Server is pointing to APNS Dev environment, certificate is
"Production", while sending notification to APNS, SOMETIMES
server will throw "Socket Closed Exception".
Server is pointing to APNS Dev environment, certificate is "Production", while sending notification to APNS, server logs says
notification sent to APNS, but device will not receive the
notification.
:) If you have done wrong configurations, you should be lucky to get "Socket Closed Exception".
If all the configurations are correct(for ex credentials, firewall), correct certificate and pointing to right APNS environment, the device will defiantly get a push notification. Push notification will work like a charm. It will be instant .
Hope this checklist will help in your implementation and sanity checks.
Am attempting to add push notifications to an application that I have created. I followed the apple guide and am able to register the device for post notifications receiving a devicetoken value from APNS. The trouble occurs when I attempt to send data to the APNS to send, I always have my connection refused.
The only thing that i have done that is non standard is that the private key for the push notification certificate was created by a non-team agent (but through the Team agents account). Does anyone know if the team agent has to generate the private key for the push notification?
If you are using Ad Hoc prov. profile, don't use sandbox apns, use the production server.
Both team agents and admins should have their private keys on their machines, they should be able to create the necessary certificates.
Is there a reason that you want to setup your own push notification server? You can just use Urbanairship which provides free push notification services.
If you still need to set up your own server, info on generating your certificates can be found here. Make sure that you're connecting to the right push server on Apple's side. There are different server's for debugging and production purposes.