Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Production iOS Device Token For Push Notifications

I understand there is a difference between a device token in distribution build vs a development build.

I have push notifications working for sandbox mode with my device token.

I created new certificates for distribution and I get successful delivery to the APSN in the distribution environment.

However, my device no longer gets the notifications (which I suspect occurs because I have my development device token being sent the the server) when using distribution settings.

I have gone to Project Scheme and set the Build Configuration to Release but the device token I get is still the same as it was before.

(Also note that I have set the Application Bundle ID to allow push notifications in both development and distribution, and I am using the distribution certificate on the server).

Could you please advise me on what I am missing to get push notifications working in development mode and what I am doing wrong to get the 'live' device token I need to send push notifications?

Bonus Question: Why does the server not return an error of "invalid device token" if it's getting a development device token instead of a distribution token for the live APNS?

ANSWER:

Needed to archive the project and export as ad-hox distribution. That worked.

like image 594
Aggressor Avatar asked Apr 08 '14 15:04

Aggressor


1 Answers

In order to test your app for push notifications you will have to wait for it to be approved.If that's not an option you can still distribute the Distribution version of your app using ad hoc.

When your application ready for submission, you create an ad hoc provisioning profile specifying an App ID that matches one or more of your apps, a set of test devices, and a single distribution certificate.

Here is an image to illustrate how the provision profile works:

enter image description here

source

like image 172
meda Avatar answered Sep 20 '22 10:09

meda