I have created an app which using APNS. I have got the push notifications when I used developer certificate and its working fine. I installed it through Adhoc method. Now I need to upload my app to appstore. I build my app with distribution certificate and put the same in the server also, but not getting any notifications. This is my first time i am doing this. I have went through so many forums and I got so many situations. One is, the token ID (i think it is the same as device token) should be different in development and production mode, but I am getting same token ID. But still I am not sure about the issue.
So I have some questions, which certificate should i use in my app and at the server when uploading to appstore? And should I use Sandbox or production server?
Please give me a clear idea about all these.
Thanks
I have created an app which using APNS. I have got the push notifications
Share
The sandbox certificate is used for development, the production certificate is used for apps submitted the AppStore. The correct certificate is linked to either the development provisioning profile or the distribution (AppStore) provisioning profile.
The one thing to remember is to recreate the provisioning profiles if you create the push certificates AFTER creating the original profile. The profiles should contain and ‘aps-environment’ string if push is enabled for your app, otherwise push won’t work. If your app initially didn’t contain push (this functionality -including certificates- were added at some later point), then the provisioning profiles for both development and the AppStore will not contain the ‘aps-environment’ string and thus push won’t work.
You can open your profiles in a text editor and look for the ‘aps-environment’ string to make sure it exists. This was the main issue with push I kept running into, so my guess is you have run into this as well.
Recreation of profiles is easy, just open them up on the Apple Developer portal, change some setting and save. Download and install the new profile to use it.
Edit: Well, I got push working with an Ad-Hoc provisioning profile. First I recommend you download the following project from github, it’s really convenient for testing development and production push:
https://github.com/Zambiorix/Apple-Push-Notification-Test
Next I’d like to know if you’re able to debug the app. If you’re able to debug the app, then you’re not using the Ad-Hoc profile. When you try to debug with the Ad-Hoc profile, the app will start followed by a crash (some message involving get-task-allow).