Unable to connect to Apple Push Notification server

We had no problems sending notifications to prepared devices using development certification and gateway.sandbox.push.apple.com. But now that our application is in the store, it seems that we can’t even connect to the apn production server (gateway.push.apple.com) to send clicks, even if we use machines that created certificates in the first place.

We ran this through PushMeBaby, and it looks like the connection to gateway.push.apple.com is failing. When he performs a handshake (SSLHandshake (context)), the result is error code -9044 or errSSLConnectionRefused. Peer-to-peer connection deleted the connection before answering.

I know enough about ssl and encryption to know that I don't know anything, but I'm sure the problem (or starts with) of our SSL production certificate. Push notification is allowed for production on the iPhone portal (we have a green light). The certificate was installed on a machine running PushMeBaby, and I see both the certificate and the signature key in my keychain. When I exported the push certificate for development and used it in PushMeBaby, I was unable to connect (and send push) any problems. But with a certificate of production, we will not go anywhere. We repeatedly revoked and recreated both cert and prod cert on two separate computers, so if this is a human error, we do it again.

One thing that can be a factor is that I have a “team agent” key on my keychain, but I'm not her. I can and transferred the binaries to the App Store without any problems.

In addition, we did not create a training profile after creating a production certificate. I’m not sure if this is a factor, but I don’t see how it could be for the app in the store.

I'm sure someone has ideas, because I'm one of them!

+4
source share
3 answers

Yes, I solved this error. I lost a few days finding a solution.

The problem is in the line:

result = SSLSetPeerDomainName(context, "gateway.sandbox.push.apple.com", 30); NSLog(@"SSLSetPeerDomainName(): %d", result); 

You must change the port to number 30. This solves the problem.

+4
source

As the documentation says, there are 2 certificates and 2 IP address for push notification:

  • Sandbox: gateway.sandbox.push.apple.com, port 2195. (for development)
  • Production: gateway.push.apple.com, port 2195. (for release)

You always use a development gateway. Try using other gateways (for production).

For more details see here: Preparation and development

+15
source

A similar problem occurred in our tests, because we tried to use the developer token, not the production one.

+1
source

Source: https://habr.com/ru/post/1302135/


All Articles