Unable to push notifications via urbanairship to APNS - apple-push-notifications

I am using the APNS for my app in development mode. I integrated with the Urban Airship as per the getting started document they provided on their portal:
Created the certificate in Apple provisioning portal. Imported the .p12 file to Urban Airship app(in dev mode with debug enabled)
Now when I open the application, it shows me the alert and asks me for the permission to enable notification. Once that is done and I try to test push a message from the Urban Airship portal to my device using the device token generated, I get the common error:
Apple Push service rejected device token "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
I searched on google and found this to be a very common problem; however with no solution. Most answers mention that the prod and dev environment conflict is the cause, however that is not the case in my case as I did not create the prod app in Urban Airship nor in the APNS dev certificate. The settings in my AirshipConfig.plist are:
APP_STORE_OR_AD_HOC_BUILD : NO
Development_App_Key: XXXXXXXXXXX
Development_App_secret: XXXXXXXXXX
(not master secret, just the dev app secret.)
Nowhere did I find the response from any user who asked the question and later got it resolved. So, I am not sure how people resolved it when they got stuck. All suggests to recheck the environment conflicts, which is not there in my case.
If anyone has any idea, please suggest the possible solutions as this is a blocker for our release. Pls also respond if this is a generic error which almost everyone gets with Urban Airship, and if Free UA account is not a feasible service for testing.

I've been fighting with these issues the last few days. The thing that fixed it for me was creating a non-wildcard identifier that was using a development provisioning profile.
Until I did this I was only able to have APP_STORE_OR_AD_HOC_BUILD : YES
Things worth checking:
Provisioning profile is set to development
Application bundle ID matches the Urban Airship bundle Id.
You can check the Urban Airship bundle Id that is used by going to:
Settings
API Keys
(See the right hand side and there should be a box that contains the iOS Bundle ID.)
Finally make sure your keys in the plist all match.
Also as you probably know, you cannot test push notifications with the simulator. I Hope this helps.

Related

New Apple Certs 12/17 [duplicate]

Attempting to upload a new production notification certificate on parse.com gives me the following error
Unsupported certificate type. Common Name (CN) must contain one of: Apple Production IOS Push Services, Apple Development IOS Push Services, Pass Type ID, Apple Development Mac Push Services, Apple Production Mac Push Services.
It appears the Common name for prod certs are now Apple Push Services: com.kylebrowning.youfree
Am I missing something?
No, you're not missing anything.
This is problem with parse.com itself.
Just wait when it will be fixed on their side.
I have also faced same problem.
While we are exporting Production certificate from Apple.
Common Name before was : Apple Production IOS Push Services:[Bundle name]
And Now : Apple Push Services:[Bundle name]
May be this is the reason Parse fails to validate certificate.
Facebook is currently investigating.
https://developers.facebook.com/bugs/987992644576840/
EDIT:
It is now working.
For those of you that did the same mistake as I did:
If you are trying to export the certificate in your private key rather than in the key itself it also gives this issue.
Basically don't open the key, just export it directly.

Are different certificates used automatically

I'm building an app that uses Parse to send push notifications. Currently I am in beta and have uploaded both a development and production push certificates. Client side, I add a bool to the Installation object to designate if the client is running a beta version.
When I send a push notification with Cloud Code how do I specify which certificate to use? Is it automatically selected for me? What happens when my app is in production simultaneously with my beta?
I don't use Parse, but I found this in their tutorial :
Note that once you have uploaded a production push certificate to Parse, you will only be able to target devices using a distribution provisioning profile. Devices running an app signed with a development provisioning profile will need to install the newly provisioned build again.
Based on this quote, you can't use Parse simultaneously for both development and production push notifications.

Get production APNS token

In development everything works fine:
my app (built with Phonegap) sends the device token to the server
my server sends the notification to the Apple servers
I receive the notification on my iPhone
But, when I switched to production (enabled push notifications and created a new SSL certificate for production) I keep getting "(8) Invalid token" from Rapns (which is installed on my push notification server).
I have read that this message is probably caused because I use a development device token in production (i.e. my server use a production certificate, but the app is running in development and sends a development device token to the server).
How can I run the app in production mode, so that I get a valid device token for production?
I think I should use an Ad Hoc Distribution Provisioning profile, but even if I have changed the "Code Signing Identity" properly in Build settings, I still get the same token I was getting in development! And this obviously doesn't work.
Solved by creating an archive - instead of run - and signing it with an Ad Hoc Distribution Provisioning profile.
You may have to delete the already installed application on the device - do a xcode clean up(for a safer side) - reinstall the application.

How to Deploy Apple Push Notification Certificate to Customer Site

Question: How can I securely include the SSL cert required for push notifications in the installer for my server product?
Background: Apple Push Notifications require a client SSL cert to be in place on the server that's making the calls to Apple.
My product has a traditional client/server architecture, i.e. a customer installs the server within their intranet and then obtains the iOS client from the App Store and connects the client to their instance of the server.
The point here is that the customer installs the server themselves, rather than a cloud architecture where I would manage the server myself.
My problem is that I don't know how to package the push notification certificate in the server installer in a secure way. I can't distribute the .p12 file without a password because that would expose my private key, and I can't use a password because the password would have to be included somewhere else in the installer which would defeat the purpose. Do I need to relay messages from all of my customers through a server that I manage, which has the SSL client cert? Do I need to install the SSL cert by hand into every one of my customers' sites?
Surely others must have run into this problem already? Or has everyone moved to the cloud?
Here is a major observation that happened to me over the weekend regarding Apple Push certificates. While there many references out there to setting up the Apple Push server side certificates, here is a MAJOR point I discovered that I cannot find referenced in any Apple documentation, or via google.
My situation: I have Push Certificates (sandbox) working great on Windows Server. Now it is time for production. Installation of production certs is successful like many times before. However, while the production push transmission completes error free, no pushes are generated to the device. Hmmm.
I just HAPPEN to notice that my Mac's time is roughly a minute off from the Windows Server (command-tabbing between MacOS and VM-Ware). Looking at Windows and Mac Settings, I see Windows internet time is set for "time.windows.com", and the mac for "time.apple.com". Just for kicks, I change the windows server time to "time.apple.com". Instantly, pushes are now being sent to the device. Nice. :-)
I dodged a major bullet here, this would have probably driven me insane trying to figure this one out. I do not claim to be an SSL cert guru... I (like most every one) just want to get this stuff to work because we have bigger fishes to fry.
I hope this is useful information.
I know only the solutions to install certificates for push notifications :
.p12, the password is in the code of the sending
.cer (.p12+private key) the password is requested at the importing of the certificate.
In the first case, you can deploy your solution, and download some code, for example xml with the password.

apple push cloud provider server testing

I have to set up push cloud notification server. I decided to use: http://pypi.python.org/pypi/pyapns/
The question that i have is how to test the server if i don't have an app which will be connected to the server? Is there any sample apps or services that would display the push notification? I just want to send payload using some sort of script and see if sending is successful or not. How people debug such things? Aren't there any kind of virtual env for such tasks?
I do have certificates and ID's of the app, but not the app it self, since the other people are making it. I do not use MAC, or have iOS device. I did read docs from apple.
So eventually i got the right .pem certificate and token of phone with the app-under-dev, phone had to registered as testing one for that app. I just pushed messages and waited for answer unit i got it. Apple do not provide any "easy to use" testing grounds, logs or messages for debugging. Best you can do is to separate pushing service and getting token as much as possible and when you got your hands on app do the raw testing.

Resources