I'm currently working on push notification workflow developed by another developer of my company.
I have a question about the sandbox for push notification.
I have generated a .pem for my production environment.
I have tested id with openssl as describe in this tutorial.
When i make the test to gateway.sandbox.push.apple.com url, the connection is ok even though i don't use the developement key and cert files (i use the prod file).
If i build and send push message to gateway.sandbox.push.apple.com with my prod pem file, the message will be send to the prod devices or dev devices ?
There's no such thing as a production device or a development device. There are devices with either a production build or a development build of your application.
You can only send a push to a development build of your app using the development environment, and likewise you can only send a push to a production build of your app using the production environment.
Production and dev builds are signed using different profiles, and this results in the push token that your app obtains being different, if you try to send a push using the sandbox environment but using a production push token then it will be rejected, and similarly attempting to use the production environment with a dev push token.
You need to set your gateway proper, use the proper PEM whether Dev PEM or Dist PEM. Xcode needs Dev profile and certificate to run and test with Dev PEM
Related
As one of our iOS applications is UNABLE to receive push/remote notifications for production/live build which installed from App Store/TestFlight but able to receive push/remote notifications in development environment and even in production environment also app is able to receive push/remote notifications from third party services like Gimbal (which is in sync with Urban Airship) but not receiving in app notifications which triggered from our servers using Java code base.
We have cross checked
Push notifications permissions in iOS devices
Device token registration/update in our databases.
All ports which are needed for APNS are open in our servers firewall restrictions.
All the .p12 certificates which we are using for development and production are not expired and even we are able to send/trigger these push/remote notifications manually from third party portals(like pushtry.com website, NWPusher) by using the same .p12 certificates even in production environment to live build installed from App Store/TestFlight.
Need help/suggestions in this issue???
Thanks
I would suggest to check the host and port used in your server for production push notification.
I hope you are removing the sandbox from the host for production push notifications.
Im trying to implement Apple Push notification.
It is working fine in Local environment. But it is not working in test flight.
I have got Automatic signing enabled.
I have included the APNS entitlement file in my build with Key APS Environment and Value Development.
I have used both of the following urls in my server,
Sandbox: gateway.sandbox.push.apple.com, port 2195.
Production: gateway.push.apple.com, port 2195.
But still the push notification is not received from testflight mode. Why so?
Since your push notification is working fine on development but not on test flight.
You should check these as below:
Use the production SSL certificate to generate the .pem file on your push server when your app is using test flight.
Make sure your pem file and device token is right on your push server
i have created in-house production push certificate not able to generate push token with iPA creation .Token is generating when app is installed with binary file through iTunes and app is installed through Xcode. Why it is happen like this can any one knows?
This is because we have 2 APNS environments - Production & Sandbox. When you generate a local build with Xcode, it gets auto signed with sandbox certs and you get connected to sandbox APNS. If your server side also using the sandbox push certificate, you will get a push with this device token.
To test production environment, you need right provisioning profile (profile with production key for .mobileprovision).
You can test APNS production environment building an AdHoc version of your App. The app will be using the production certificates and servers and it's purpose is exactly to test BEFORE you send it to AppleStore. Alternatively, you can test production pushes by downloading form App Store that is like more real time.
I'm trying to get my server to deliver push notifications via Apple's Push Notification service. (APNs)
My setup is as follows:
Cordova HTML/JS app
API in Rails on VPS via https
Houston gem for Push Notifications
I've created a certificate for development on my mac. When I run my server locally it successfully sends the notification to my iPhone.
I'm now trying to get it working on my server but without luck. I've generated a CSR locally, uploaded it in Apple's iOS App ID's editor and downloaded the CER. I then exported the CER to p12 with Keychain Access and converted that to a PEM file with the following command:
openssl pkcs12 -in apn_production.p12 -out apn_production.pem -nodes -clcerts
Houston needs this PEM file to send push notifications, I've done the same for development and it worked, but it needs to send from a server now, which could be the problem, I don't get any errors though. The notifications just don't arrive, which could be a production/development mistake I'm making.
I also tried creating a CSR file on my server and upload that via the iOS App ID's editor, but when I download the CER and open it in Keychain Access I'm not able to export it to P12, only to CER, PEM and P7B. Also there isn't a private key in this file, which there is within my locally created development certificate. Also when I export it to PEM and use it with Houston on my server it throws an error that the certificate is invalid.
Another thing I tried was upload the CSR generated by my VPS on the Apple Push Certificates Portal. This throws an error mentioning the certificate is invalid.
There's a couple things I'm not sure of:
1. Am I in development or production mode?
The app is not yet in the app-store, but it is in beta mode to download via TestFlight and push notification need to be send from my server. Is this a production environment or development or do I need to define this manually somewhere before building the App?
2. Is it possible to use a locally generated CSR for a PEM to be used on my server?
Am I right that I need a server generated CSR to start with when I finally need a PEM to send push notifications with from my server?
3. What do do now, how should I debug?
The PEM generated from my locally generated CSR is now uploaded to my server and Houston doesn't throw errors whatsoever. The push notifications don't arrive though, so, what should I do, can I trace these push notifications somewhere? Is there some APN logfile which I can read?
1) You need to use production certificates for sending push notifications via test flight.
2) You do not need a server generated CSR. You only need a valid ".pem" for sending push notification.
3) You need to remove sanbox (sandbox mode) from push notification url in push sending script. Also check if port 2195 of your server is open for communication or not because APNS communicates via this port.
I am implementing push notifications, it's working in development mode.
In production mode, when I run the application I get this message in Xcode but the application installs on the device.
launch failed: failed to get the task for process 11288
After opening the app on device I get token id, but not get the notification, when I run simple.php file in terminal I get message as
connected to APN
Message successfully delivered
I have used AdHoc production provisioning certificate to test the application.
Can you tell me how to test push notifications in production.
You need to use a production push certificate, which you can generate the same way you do with a development certificate (just choose production), as well as change your server address from gateway.sandbox.push.apple.com to gateway.push.apple.com...
EDIT: You are not allowed to debug production apps, which is why you get that Xcode error in production mode...
First, You get the following error
launch failed: failed to get the task for process 11288
Because, you are running app in Production (adhoc/distribution/release) scheme mode.
Second,Your pem file and its password should be correct. Also make sure you are using the correct gateway for Production.
We could help you more, if you can share your server file here.
Thanks