Obtaining an “unknown token” using GCM on iOS

I installed GCM in an iOS application and everything works fine in development, I was abel to receive a push notification. But when I published it in the application store, the device did not receive a push notification (works fine on Android).

I installed the PersistentConnectionLogging.mobileconfig file on my iOS device to see the logs, and here is what I saw:

Received an incoming push notification for topic: com.bundle.id, but for a completely unknown XYZ token

here are the exact output messages

 Jun 24 11:45:35 iPhone apsd[103] <Notice>: 2016-06-24 11:45:35 -0700 apsd[103]: Received incoming push notification for topic: com.bundle.id but for a completely unknown token <95af08c3 c74a13bf 6b6fb270 c486f2b3 58989f44 dfe69bc0f 95u410e1 2431b8dc> Jun 24 11:45:35 iPhone apsd[103] <Notice>: 2016-06-24 11:45:35 -0700 apsd[103]: <APSCourier: 0x137d035e0>: Responding with REMOVED status for message received with topic: 'com.bundle.id' to device token (instead of per-app token) 

Any idea why this is happening? Why is the token "unknown"? Who does he belong to?

+5
source share
2 answers

Have you tried push certification certification? ? Houston on GitHub is often used to test certificates. Basically, if clicking does not work with a third party, you will need to recreate your certificates.

Using Houston in Cli:

apn push "<5e8f5cc0 be283f88 cc4ebb7d b6091499 80f51631 5ebf4928 b59a2a62 198d20d0>" -c -out "apple_push_notification.pem" -m "Hello from the command line!"

* Houston says: * We recommend that you upload development, production, and any special certificates. The layer will automatically determine which certificate to use.

Other potential causes:

  • Are you calling [layerClient updateRemoteNotificationDeviceToken...] correctly?

  • Are you calling inside didRegisterForRemoteNotificationsWithDeviceToken to send a Layer device token?

You can also check if the application is working by doing didFailToRegisterForRemoteNotificationsWithError . If you look at the error, you must find out why you do not see the click.

Obj-C Error Check Example :

 - (void) application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { NSLog(@"PUSH ERROR: %@", error); } 

Example of quick error checking :

 func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError!) { print("PUSH ERROR: \(error)") } 

A potential Xcode / Certificate issue causes:

  • Profile profiles are not updated. Information about the device is stored in certificates, so each time you add a new device to your profile, you will need to re-create the profile and certificates.
  • Make sure your Xcode project settings indicate the correct certificate profile and Provisioning.
  • Inside the Keychain Access application, make sure you export the key AND certificate.
+1
source

There are two types of certificates provided by the iOS application, one for development mode and one for production mode. If you use a development certificate, the generated token is the development token, and it does not work in production mode. You must use a production certificate and create a production token.

0
source

All Articles