Question

Hi so I'm very confused at the moment and don't know what to do next. I've spent the last two weeks getting these push notifications to work correctly, and when I finally have it all neat and tidy, I put it into an adhoc distribution bundle and switch the server configurations to the production environment, suddenly nothing works and I have no error messages to go off of. It should work, it should work and it doesn't. So I need some help because I'm lost.

possible problems -

HOST CONFIG

What really helped me get it working in the first place was this tutorial here, the hosting server is Heroku and the application is written in Sinatra using this gem, and if that doesn't carry over to production environment in someway I am not seeing please tell me. To update the environment to production, I just changed which key was used and the host from gateway.sandbox.push.apple.com to gateway.push.apple.com as shown here:

server_config.jpg

APNS KEYS

I don't think it's this, but I don't understand what is going on so I documented it, but the distribution key works I believe - running

openssl s_client -connect gateway.push.apple.com:2195 -cert dis_apskey.pem 

in the terminal got this connection and transaction with the push server:

openssl_connecting.jpg

Which I believe means it worked though I don't know for sure (see edit in answer, this does NOT mean it worked). The keys were made with this command:

openssl pkcs12 -in aps_distribution.p12 -out dis_apskey.pem -nodes

from the private keys of the APS Development and Distribution certificates downloaded from the iOS development portal or whatever it is called now, exported as .p12 encrypted files:

keychain.jpg

Though, while from different private keys they did turn out strangely similar (all characters are the same)-

enter image description here

Is that normal? because I made both the push service certificates from the same CSR, I dunno I'm totally lost... just throwing it out there, because none of this makes sense anymore.

CODE SIGNING

I believe this is correct (from my xcode project):

enter image description here

Those correspond to the certificates and mobile provisioning profiles in my iOS Developer Portal and I have regenerated so many new ones, refreshed them in xcode, double checked and reloaded them in to this thing that I'd find it hard to believe this is the area of issue. But just to make sure I'm posting it, those are current profiles, made after the APS Certificates were issued. Again, this doesn't make a whole lot of sense to me and yes, I've read the documentation and it's still greek.

MOBILE DEVICE TOKENS

This again, I don't see being the issue. My app generated one token using the development profile and the sandbox was able to push notifications to it and it worked BEAUTIFULLY! Then my app generated a NEW token when I switched to the adhoc profile and build BUT with the production environment nothing gets through to it. I'll say again, everything was working correctly on the sandbox but does not now.

Any other reasons?

That's all I can think of, if anyone has something else please let me know. I just want this working and I can't see the errors if apple sends them back to failed pushes so I have no clue. It was working in the developer sandbox and should be working now, that's all I can think of.

Thanks.

Was it helpful?

Solution

So after a long problematic bought of frustration spanning two days. What worked. Reading

enter image description here

I needed to export both items

enter image description here

followed by the .pem conversion.

and success!!

Edit: I should also note that the picture of the ssl connection to gateway.push.apple.com in the question was NOT a correct connection, using the new .pem key here produced by the answer the socket does not "close" immediately. You should be able to type something there before it's closed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top