3

I have created development and production certificates with Push Notification enabled. Everything works fine on test environment but when I try to test the development certificate on our production environment, it give me following error message from my Java server.

06:56:47,054 WARN  ~ APNS push FAILED to 7ccd6139db05e657cedf27e00b93c71851cc779489474e4cede40d66182e4b26
06:56:47,054 WARN  ~ Here's the problem: javapns.notification.exceptions.ErrorResponsePacketReceivedException: An error response packe
t was received from the APNS server: APNS: [1] Invalid token
06:56:47,055 ERROR ~ javapns.notification.exceptions.ErrorResponsePacketReceivedException: An error response packet was received from 
the APNS server: APNS: [1] Invalid token
        at javapns.notification.PushedNotification.setResponse(PushedNotification.java:173)
        at javapns.notification.ResponsePacket.linkToPushedNotification(ResponsePacket.java:31)
        at javapns.notification.ResponsePacketReader.handleResponses(ResponsePacketReader.java:75)
        at javapns.notification.ResponsePacketReader.processResponses(ResponsePacketReader.java:27)
        at javapns.notification.PushNotificationManager.processedFailedNotifications(PushNotificationManager.java:223)
        at javapns.notification.PushNotificationManager.stopConnection(PushNotificationManager.java:198)
        at javapns.Push.sendPayload(Push.java:185)
        at javapns.Push.payload(Push.java:149)
        at jobs.APNSPushEvent.doJob(APNSPushEvent.java:46)
        at play.jobs.Job.doJobWithResult(Job.java:50)
        at play.jobs.Job.call(Job.java:146)
        at play.jobs.Job$1.call(Job.java:66)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:722)

2 Answers2

3

APNS: [1] Invalid token means the device token you used is invalid. Assuming your app got this device token from Apple (and you didn't use a random token), you are probably using a development token to send push notification to the production push server or vica versa. A device token is only valid in one environment (either sandbox or production).

Eran
  • 387,369
  • 54
  • 702
  • 768
  • Thanx but how i get different device token? – kamlesh shingarakhiya Nov 13 '13 at 04:47
  • @kamleshshingarakhiya The token that your device gets from APNS depends on the provisioning profile you signed your app with (it contains an aps-environment entitlement that is either sandbox or production). – Eran Nov 13 '13 at 17:49
0

Notification delivers to client successfully when both the places uses the same type of certificates.

In order to test the notifications in development environment you need to build the client using development certificates as well as server should also use the development certificate. Otherwise it will fail.

Ganesh
  • 524
  • 1
  • 4
  • 16