Mohamad Kamal
Mohamad Kamal

Reputation: 105

push notifications on testflight

i am using uraban airship for sending notifications for my ios app and it worked fine for my development phase now i have replaces my provisioning profile with a production one, and i created a new apns certificate for it , and uploaded this certificate to my new production app on urbanairship and what i got was nothing.

i tried making a new appid and revoking my certificates and reissue them but what got was nothing . i should mention that i am testing my app on tesflight with a production provision profile and not an adhoc , is that ok ? must i release to the appstore so it work?

Upvotes: 1

Views: 3250

Answers (3)

Scrungepipes
Scrungepipes

Reputation: 37581

Check all 4 things in your chain of use are now production:

While there are other reasons, in a very high percentage of the time the reason for a push failure is due to the fact that the push “equation” has been broken.

There are two equations, either one of which must be followed exactly in order for pushes to work.

The Development equation:

Development build of the App + Development APN token + Development Certificate + Development Apple gateway == SUCCESS

The Production equation:

Production build of the App + Production APN token + Production Certificate + Production Apple gateway == SUCCESS.

If you have any dev element in the production equation, or any production element in the development equation then the push will NOT work. All four elements of the equation must be either all development or all production.

When you run the app via Xcode it will be a development build of the app by default (it can be changed in the scheme but unless you know this and have done so then it will be a debug build) and thus when using Xcode you must use the development equation for pushes to function. If you create an ad-hoc distribution or app store build then it will be a production build and you must use the production equation for it to work.

If creating an ad-how / distribution / app store build etc. then a common cause of failure is not setting Xcode's code-signing and provisioning profiles section in the build setting appropriately.

Also the production build of the app and the development build of the app result in different push tokens, so if you are temporarily hard-coding a token into some server test script or similar, then you must make sure its the correct token. In older versions of iOS the tokens would effectively never change once you had obtained it (they could, but the circumstances when it would were rare). But in iOS9 this is no longer the case and the token can and does change, so always make sure the token you are using on the server is up to date.

Pushes must also be sent over the correct gateway, the Apple development gateway is the sandbox gateway:

ssl://gateway.sandbox.push.apple.com:2195

While the production gateway is:

ssl://gateway.push.apple.com:2195

When using the production gateway the server must be signed with the production certificate of course, and signed with the development certificate when using the sandbox gateway.

If you use the same password for both certificates then you can sign your server with both the production certificate and development certificate in the same .pem file. I.e. You can concatenate all the elevate certificates and keys into a single .pem file and use that to sign the server. The server will of course need to use the sandbox gateway when testing using Xcode and the production gateway for the final app store release.

Upvotes: 4

Hardik Shah
Hardik Shah

Reputation: 179

As you are using Urban Airship,

You should have two App and Secret Keys, 1) Developer App Key and 2) Production App Key

Please make sure you have set the valid/proper Production App key and Secret Key in .plist file and also set the "detectProvisioningMode" true.

I hope you have checked the information @ http://docs.urbanairship.com/platform/ios.html

Upvotes: 0

Mohamad Kamal
Mohamad Kamal

Reputation: 105

what worked for me in the end is that i used pushwoosh to auto integrate with my apple developer account and they auto imported my certificate so i think it might have been a problem with exporting my certificate with the p12 format some how

Upvotes: 0

Related Questions