1
votes

I didn't realize this until after I submitted my app to the App Store (and its now available) that there was a difference between a distribution and production token. During development, push notification worked for me, but after downloading it from the App Store, it didn't work.

I have push notifications enabled for development and distribution. I have created the appropriate development and distribution provisioning profile with push notifications enabled.

Some questions that I have is:

Is there anything I can do in my .php file, now that the app is in the app store, to allow push notification without submitting another update, i.e. changing the APNS server location from development to production?

Do I have to change how I fetch token within AppDelegate.m? Right now I have this within didRegisterForRemoteNotificationsWithDeviceToken:

NSString *token = [ [deviceToken description] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"<>"] ];

// Remove spaces from the token
token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];

How can I test the production mode in Xcode? I have already created an Ad-Hoc certificate.

Thanks

3

3 Answers

2
votes

You just have to make two changes to your php script, and the rest will work:

  1. Change the destination to gateway.push.apple.com:2195 instead of gateway.sandbox.push.apple.com:2195`.
  2. Sign your push notification with a production certificate, instead of a development certificate.

The rest should work fine. Production tokens will have production push notifications sent accordingly.

1
votes
  • First export the ipa file with adhoc certificate and install it on your iphone.
  • By this way you can test your production cert But you can't test(run) directly through xcode.
  • Check your php side message is sent successfully or not.
0
votes

I realized I didn't upload the ck.pem file (combination of certificate and key) onto the server.

Now it's fixed.