1

We have a application that uses APNs services and the backend/server of the application is in .net. I have created the dev and prod Cert. for the application and placed the production certificate on the production server.

We have no problem in receiving the push notification and everything works fine on development server with development certificate. The issue is with the production server when we hit a web services that trigger the push notification it does not send the response and after request timeout it gives the 504 response.

Is there anyone who faces the same issue or anyone can help to get out of this?

P.S I have commented the push notification code on live server and it works fine so I am deadly sure that issue is with the push notification service.

user1725145
  • 3,993
  • 2
  • 37
  • 58
Usman Awan
  • 1,208
  • 2
  • 13
  • 30

2 Answers2

1

The binary interface of the production environment is available through gateway.push.apple.com, port 2195; the binary interface of the development environment is available through gateway.sandbox.push.apple.com, port 2195.

See: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html

A. Make sure that you use the correct link when pushing the notification

For Development, you use: gateway.sandbox.push.apple.com

For Production, you use: gateway.push.apple.com

B. When you build and run the XCode project directly to the connected device, the generated IPA is using development provisioning certificate. So, the production push notification will not send to the device. I make this mistake when I started to learn about push notification long time ago.

In order for you to test the production push notification on your device, you must:-

  1. Delete the app from your device.

  2. Make sure that the provisioning profile under "Release" is using an ad-hoc distribution profile. enter image description here

  3. Generate an ad-hoc provisioning IPA using Archive. Export the IPA to desktop or anywhere you like.

  4. Open the Organizer from your XCode, go to "devices". Drag and drop the newly generated IPA into the application of your current connected device.

  5. The app available on your device is now using Distribution certificate. The device token it sends to the server will be different compare with device token for development certificate. So, you must use the correct device token.

If you are doing everything correctly, you should receive the production push notification.

Ricky
  • 10,485
  • 6
  • 36
  • 49
  • Thank for your answer Ricky. I am have the done all these steps and using the production certificate for production server. It was working before when I had a hard coded path to Web Server file directly for certificate. The problem is with the response that has not been send by my web service when I try to hit it from my iPhone device that using the ad-hoc distribution profile. – Usman Awan Aug 28 '14 at 12:14
  • Honestly, I don't know what you mean by "hit with web service". Are you able to try a manual push message without using the web service? Or try to push using Parse.com or other free Push notification provider. – Ricky Aug 29 '14 at 01:28
  • hitting the web service mean request the rest api to send the push notification. – Usman Awan Aug 29 '14 at 12:58
0

After lots of debugging of application and also creating certificates again but it does not help my cause until I read this document on apple documentation regarding push notification:

According to apple these ports should be open on web server for sending notifications. Below is what about has written in their support documentation for APNs.

IP Address Range Used by the Push Service

Push providers (web server) are often behind firewalls. To send notifications, you will need to allow inbound and outbound TCP packets over port 2195. To reach the feedback service, you will need to allow inbound and outbound TCP packets over port 2196.

https://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG31

While my hosting provider has not opened these ports on server where my site is hosted.

Thanks you all for helping me in this problem.

Usman Awan
  • 1,208
  • 2
  • 13
  • 30