Skip to content
This repository was archived by the owner on Feb 7, 2019. It is now read-only.
This repository was archived by the owner on Feb 7, 2019. It is now read-only.

Apns notification error: 'InvalidToken' #240

@dpdragnev

Description

@dpdragnev

We are experiencing an issue with sending notifications to our test iOS device. Everything works well on Android. Here is our environment:

nodejs: 8.9.4
npm: 5.8.0
tns-ios: 4.1.0
push-plugin: 1.0.4
tns: 4.1.2

The certificates, the provisioning profile, and the p12 files were generated on the same machine (iMac).
The correct certificate and provisioning profile are set up in Sidekick. We are testing it via pushtry.com as well as locally via our API.

Here is how we generate the token:

    //iOS
    let iosSettings = {
      badge: true,
      sound: false,
      alert: true,
      clearBadge: false,
      interactiveSettings: {
        actions: [
          {
            identifier: "READ_IDENTIFIER",
            title: "Read",
            activationMode: "foreground",
            destructive: false,
            authenticationRequired: true
          },
          {
            identifier: "CANCEL_IDENTIFIER",
            title: "Cancel",
            activationMode: "foreground",
            destructive: true,
            authenticationRequired: true
          }
        ],
        categories: [
          {
            identifier: "READ_CATEGORY",
            actionsForDefaultContext: ["READ_IDENTIFIER", "CANCEL_IDENTIFIER"],
            actionsForMinimalContext: ["READ_IDENTIFIER", "CANCEL_IDENTIFIER"]
          }
        ]
      },
      notificationCallbackIOS: (message: any) => {
        //console.log('Push notification from iOS: ', message);
        //let response = JSON.parse(message);
      }
    };

    pushPlugin.register(
      iosSettings,
      (token: String) => {
        appSettings.setString(SettingsEnum.DEVICE_TOKEN.toString(), token.toString());

        pushPlugin.registerUserNotificationSettings(() => { }, err => { });
      },
      function (errorMessage: any) {
        console.log("Error from Apple notification: ", errorMessage);
      }
   );```

What are we missing?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions