question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

meteor run ios-device - Got error code 8 for token 289c6277eb...

See original GitHub issue

meteor run ios-device --mobile-server http://192.168.100.102:3000 --production

XCode console output: 2016-08-25 16:10:35.116 pushNotificationsTest[1656:437532] Apache Cordova native platform version 4.1.0 is starting. 2016-08-25 16:10:35.119 pushNotificationsTest[1656:437532] Multi-tasking -> Device: YES, App: YES 2016-08-25 16:10:35.132 pushNotificationsTest[1656:437532]

Started backup to iCloud! Please be careful. Your application might be rejected by Apple if you store too much data. For more information please read “iOS Data Storage Guidelines” at: https://developer.apple.com/icloud/documentation/data-storage/ To disable web storage backup to iCloud, set the BackupWebStorage preference to “local” in the Cordova config.xml file

2016-08-25 16:10:35.305 pushNotificationsTest[1656:437532] Using WKWebView 2016-08-25 16:10:35.306 pushNotificationsTest[1656:437532] [CDVTimer][handleopenurl] 0.176966ms 2016-08-25 16:10:35.310 pushNotificationsTest[1656:437532] [CDVTimer][intentandnavigationfilter] 3.618956ms 2016-08-25 16:10:35.310 pushNotificationsTest[1656:437532] [CDVTimer][gesturehandler] 0.158012ms 2016-08-25 16:10:35.389 pushNotificationsTest[1656:437532] Serving asset bundle version: d9b00d3fe0babf9a274b0f3d791ef6c2ac782ca5 [INFO] GCDWebServer started on port 12512 and reachable at http://localhost:12512/ 2016-08-25 16:10:35.392 pushNotificationsTest[1656:437532] [CDVTimer][webapplocalserver] 81.638038ms 2016-08-25 16:10:35.402 pushNotificationsTest[1656:437532] [CDVTimer][statusbar] 9.907007ms 2016-08-25 16:10:35.411 pushNotificationsTest[1656:437532] [CDVTimer][splashscreen] 8.849025ms 2016-08-25 16:10:35.412 pushNotificationsTest[1656:437532] [CDVTimer][TotalPluginStartup] 105.735958ms 2016-08-25 16:10:35.418 pushNotificationsTest[1656:437532] createNotificationChecker 2016-08-25 16:10:35.418 pushNotificationsTest[1656:437532] not coldstart 2016-08-25 16:10:35.420 pushNotificationsTest[1656:437532] active 2016-08-25 16:10:35.420 pushNotificationsTest[1656:437532] PushPlugin skip clear badge 2016-08-25 16:10:36.194 pushNotificationsTest[1656:437593] Push Plugin register called 2016-08-25 16:10:36.194 pushNotificationsTest[1656:437593] PushPlugin.register: setting badge to false 2016-08-25 16:10:36.194 pushNotificationsTest[1656:437593] PushPlugin.register: clear badge is set to 0 2016-08-25 16:10:36.194 pushNotificationsTest[1656:437593] PushPlugin.register: better button setup 2016-08-25 16:10:36.195 pushNotificationsTest[1656:437593] GCM Sender ID (null) 2016-08-25 16:10:36.195 pushNotificationsTest[1656:437593] Using APNS Notification 2016-08-25 16:10:36.236 pushNotificationsTest[1656:437532] Push Plugin register success: <289c6277 eb9b2904 cbe43a22 8b58ccbd 36bcabdd 45a22e98 a32e8f45 f437ae63>

This is my project structure:

myPushNotificationsTest
|------> client
|             |------> main.css
|             |------> main.html
|             |------> main.js
|------> lib
|              |------ notifications.js
|------> mobile-config.js
|------>  package.json
|------  private
|            |------> ios
|                          |------> apn-development
|                                         |------>   cert.pem
|                                         |------>   key.pem
|                          |------>  apn-production
|                          |               |------>  cert.pem
|                          |               |------>  key.pem
|                          |------>  entrust_2048_ca.cer
|                          |------>  entrust_l1c.cer
|------> server
              |------> main.js

mobile-config.js

// This section sets up some basic app metadata,
// the entire section is optional.
App.info({
  id: 'com.viboz.myPushNotificationsTest', // replace with your bundle ID
  name: 'pushNotificationsTest',               // replace with your own name
  author: 'Luis'
});

// Pass preferences for a particular PhoneGap/Cordova plugin
App.configurePlugin('phonegap-plugin-push', {
  SENDER_ID: '829xxxxxxxxx'
});

// Set up external locations the app needs access to.
App.accessRule("*", {external: false});

// Set PhoneGap/Cordova preferences
App.setPreference('BackgroundColor', '0xff0000ff');
App.setPreference('HideKeyboardFormAccessoryBar', true);

client --> main.html:

<head>
  <title>pushNotification_Meteor1344_raix3.0.3-rc.5</title>
</head>

<body>
  <h1>Welcome to Meteor!</h1>

  {{> hello}}
  {{> info}}
</body>

<template name="hello">
  <button> Press button </button>
  <p>You've pressed the button {{counter}} times.</p>
</template>

<template name="info">
  <h2>DEVICE INFO</h2>
  <ul>
    <li><a target="_blank">Device Registration ID: {{deviceId}}</a></li>
    <li><a target="_blank">Model: {{model}}</a></li>
    <li><a target="_blank">Platform: {{platform}}</a></li>
    <li><a target="_blank">UUID: {{uuid}}</a></li>
    <li><a target="_blank">Manufacturer: {{manufacturer}}</a></li>
    <li><a target="_blank">Version: {{version}}</a></li>
    <li><a target="_blank">Serial: {{serial}}</a></li>
    <li><a target="_blank">Cordova version: {{cordova}}</a></li>
  </ul>
</template>

client --> main.js

import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';

import './main.html';

Meteor.startup(() => {
  Push.debug = true;
});

Template.hello.onCreated(function helloOnCreated() {
  // counter starts at 0
  this.counter = new ReactiveVar(0);
});

Template.hello.helpers({
  counter() {
    return Template.instance().counter.get();
  },
});

Template.hello.events({
  'click button'(event, instance) {
    // increment the counter when button is clicked
    instance.counter.set(instance.counter.get() + 1);
  },
});

Template.info.onCreated(function helloOnCreated() {
  document.addEventListener("deviceready", onDeviceReady, false);
  function onDeviceReady() {
      Session.set("cordova",device.cordova);
      Session.set("model",device.model);
      Session.set("platform",device.platform);
      Session.set("uuid",device.uuid);
      Session.set("version",device.version);
      Session.set("manufacturer",device.manufacturer);
      Session.set("serial",device.serial);

      Push.Configure({
        android: {
          senderID: 829xxxxxxxxx,
          alert: true,
          badge: true,
          sound: true,
          vibrate: true,
          clearNotifications: true
          // icon: '',
          // iconColor: ''
        },
        ios: {
          alert: true,
          badge: true,
          sound: true
        }
      });

      Push.addListener('token', function(token) {
        console.log('Token: ' + JSON.stringify(token));
        alert('Token: ' + JSON.stringify(token));
        Session.set("deviceId",JSON.stringify(token));
      });
      console.log('Push.id(): ' + Push.id());

      function sendPush(pushObject){
        console.log('Pushing: ' + JSON.stringify(pushObject));
        Push.send({
            from: pushObject.from,
            title: pushObject.title,
            text: pushObject.text,
        query: {}
        });
      }
  }
});

Template.info.helpers({
  deviceId: function () {
      return Session.get("deviceId");
  },
  model: function() {
    return Session.get("model");
  },
  platform: function() {
    return Session.get("platform");
  },
  uuid: function() {
    return Session.get("uuid");
  },
  version: function() {
    return Session.get("version");
  },
  manufacturer: function() {
    return Session.get("manufacturer");
  },
  serial: function() {
    return Session.get("serial");
  },
  cordova: function() {
    return Session.get("cordova");
  }
});

lib --> notifications.js

NotificationHistory = new Mongo.Collection("notification_history");

server --> main.js

import { Meteor } from 'meteor/meteor';

Meteor.startup(() => {
  // code to run on server at startup
  Push.debug = true;
  Push.Configure({
    gcm: {
      apiKey: 'AIzaS...',
    },
    //--> DEV
    // apn: {
    //   sound: true,
    //   passphrase: 'Password2016',
    //   keyData: Assets.getText('ios/apn-development/key.pem'),
    //   certData: Assets.getText('ios/apn-development/cert.pem'),
    //   production: false,
    //   gateway: 'gateway.sandbox.push.apple.com'
    // },
    //<-- DEV
    //--> PROD
    apn: {
    sound: true,
    passphrase: 'Password2016',
    keyData: Assets.getText('ios/apn-production/key.pem'),
    certData: Assets.getText('ios/apn-production/cert.pem'),
    production: true,
    gateway: 'gateway.push.apple.com'
    },
    //<-- PROD
  });

  Push.allow({
    send: (userId, notification) => {
      // allow all users to send notifications
      return true;
    }
  });
});

Meteor.methods({
        serverNotification: function () {
            DevicesHistory.insert({
                deviceId: Session.get("deviceId"),
                addedAt: new Date()
            }, function (error, result) {
                if (error) {
                    console.log(error);
                }
            });
        },
});

METEOR@1.3.4.4 raix:push@3.0.3-rc.5 meteor add cordova:cordova-plugin-device@1.1.2 (need to install in that way or meteor show error) meteor add cordova:phonegap-plugin-push@1.6.4 (need to install in that way or meteor show error)

This is working for android, with meteor shell --> Push.send({from: ‘push’,title: ‘Congratulations’,text: ‘My message!’,query: {}}); i receive the push notification on android. For ios the device is registered but i get “Got error code 8 for token 289c6277eb…” when i try Push.send from meteor shell.

When i deploy my app to itunes connect the mail i receive say:

**_Dear developer,

We have discovered one or more issues with your recent delivery for “myPushNotificationTest”. Your delivery was successful, but you may wish to correct the following issues in your next delivery:

Missing Push Notification Entitlement - Your app includes an API for Apple’s Push Notification service, but the aps-environment entitlement is missing from the app’s signature. To resolve this, make sure your App ID is enabled for push notification in the Provisioning Portal. Then, sign your app with a distribution provisioning profile that includes the aps-environment entitlement. This will create the correct signature, and you can resubmit your app. See “Provisioning and Development” in the Local and Push Notification Programming Guide for more information. If your app does not use the Apple Push Notification service, no action is required. You may remove the API from future submissions to stop this warning. If you use a third-party framework, you may need to contact the developer for information on removing the API.

After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.

Regards,

The App Store team_**

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
derwaldgeistcommented, Jul 25, 2017

It is important that an app is running in production mode only if

  • it has been installed via the app store
  • it has been deployed as an .ipa file on the device

If you deploy it using Xcode’s play button, iOS will always treat it as in “development” mode. This will result in errorcode 8, if the server is running on a localhost or push is not configured for development mode.

1reaction
indesignlatamcommented, Aug 25, 2016

Hi @Luis16287, That is most probably a problem with your provisioning profile, you have to solve it in developer.apple.com, you go to account -> click on Certificates, Identifiers & Profiles -> click on identifiers - app ids -> select your app -> click on edit -> select push notifications.

Maybe you already did this, sometimes provisioning profiles get weird and you may have to remove the ones you have in your pc and get new ones.

Read more comments on GitHub >

github_iconTop Results From Across the Web

run ios - error "Device type (...) could not be found" #9126
Hello everybody, I am facing with a problem concerning the command meteor run ios. I searched on Stack Overflow, etc but I did...
Read more >
[SOLVED]iOS Emulator ERROR - mobile - Meteor.js forums
Hey all! ... This is my first try at using the simulator with Meteor, so I am not totally sure where to begin...
Read more >
ios - What are the possible reasons to get APNs responses ...
As you've quoted from Table 8-6 in the APNS documentation, there are two possible causes for the error: That the device token is...
Read more >
Meteor and React Native - Create a native mobile app
This is the final code repo for our workshop "Meteor and React Native" ... on Ubuntu Linux but run our development build on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found