Apple Push Notification not working with ad-hoc bu

2019-03-27 15:48发布

问题:

In development mode I can send push notification to devices, instead I can't in production, my setup is:

  • .pem file that is the combination of aps_production.cer of provisioning portal and the private key of my ad-hoc certificate
  • apple server apn: 'gateway.push.apple.com' with 2196 port
  • I have a rails server that saves tokens from devices and then sends notification to apple with those device tokens and the previous .file for opening connection
  • ad-hoc build applications have (it's rubymotion): entitlements['aps-environment'] = 'production' entitlements['get-task-allow'] = false
  • application when it starts, sends correctly the token to my application server
  • I just checked that the token is different from development mode

The problem is that my rails application sends notifications and didn't receive any errors, but nothing arrived on devices.

I'm using testflight for distribute ad-hoc version of my application, but I don't known any problem using testlight and APNS.

What can be?


EDIT I resolved: the port was wrong, 2195 instead of 2196...

回答1:

APNs have a separate SSL certificate for production and for development.

You are probably using your development certificate with the production build.