Ionic push not work

form http://ionicframework.com/docs/native/push/

ionic start aaa tabs
pod setup
cordova plugin add cordova-plugin-crosswalk-webview
ionic upload (sync APP ID)
ionic cordova plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX
npm install --save @ionic-native/push
ionic Cordova platform add ios
ionic Cordova platform add android
Preformatted text

in ionic.io > setting > Certificates I upload all Certificates iOS and FCM android success
I test on device Samsung Galaxy S3 4.3 It not work not show error and it Nothing happened.
I test on device iPhone 6Plus 10.3.2 it show log token from Xcode


2017-06-07 14:27:52.600567+0700 PSP for parient[802:357967] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/36F6DB34-2116-44A7-9440-4A21D051B90D/Library/Cookies/Cookies.binarycookies
2017-06-07 14:27:52.841985+0700 PSP for parient[802:357967] Apache Cordova native platform version 4.4.0 is starting.
2017-06-07 14:27:52.843091+0700 PSP for parient[802:357967] Multi-tasking -> Device: YES, App: YES
2017-06-07 14:27:52.966243+0700 PSP for parient[802:357967] Using UIWebView
2017-06-07 14:27:52.969809+0700 PSP for parient[802:357967] [CDVTimer][handleopenurl] 0.147998ms
2017-06-07 14:27:52.974129+0700 PSP for parient[802:357967] [CDVTimer][intentandnavigationfilter] 4.203022ms
2017-06-07 14:27:52.974383+0700 PSP for parient[802:357967] [CDVTimer][gesturehandler] 0.150979ms
2017-06-07 14:27:52.997387+0700 PSP for parient[802:357967] [CDVTimer][splashscreen] 22.854984ms
2017-06-07 14:27:53.011666+0700 PSP for parient[802:357967] [CDVTimer][statusbar] 14.114976ms
2017-06-07 14:27:53.013673+0700 PSP for parient[802:357967] [CDVTimer][keyboard] 1.798987ms
2017-06-07 14:27:53.013843+0700 PSP for parient[802:357967] [CDVTimer][TotalPluginStartup] 44.175982ms
2017-06-07 14:27:53.207515+0700 PSP for parient[802:357967] createNotificationChecker
2017-06-07 14:27:53.207599+0700 PSP for parient[802:357967] not coldstart
2017-06-07 14:27:53.211037+0700 PSP for parient[802:357967] active
2017-06-07 14:27:53.212304+0700 PSP for parient[802:357967] PushPlugin skip clear badge
2017-06-07 14:27:53.285733+0700 PSP for parient[802:358127] libMobileGestalt MobileGestaltSupport.m:153: pid 802 (PSP for parient) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-06-07 14:27:53.285850+0700 PSP for parient[802:358127] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
2017-06-07 14:27:54.153256+0700 PSP for parient[802:357967] Resetting plugins due to page load.
2017-06-07 14:27:58.479576+0700 PSP for parient[802:357967] Finished load of: file:///var/containers/Bundle/Application/B3E5C1EF-BDB1-4145-9D56-52B63D35C54C/PSP%20for%20parient.app/www/index.html
2017-06-07 14:27:59.023147+0700 PSP for parient[802:357967] THREAD WARNING: ['Device'] took '39.726807' ms. Plugin should use a background thread.
2017-06-07 14:27:59.168189+0700 PSP for parient[802:357967] Ionic Native: deviceready event fired after 4060 ms
2017-06-07 14:27:59.168321+0700 PSP for parient[802:357967] DEVICE READY FIRED AFTER 3797 ms
2017-06-07 14:27:59.232287+0700 PSP for parient[802:357967] THREAD WARNING: ['StatusBar'] took '63.853027' ms. Plugin should use a background thread.
2017-06-07 14:27:59.260093+0700 PSP for parient[802:358126] Push Plugin register called
2017-06-07 14:27:59.261644+0700 PSP for parient[802:358126] PushPlugin.register: setting badge to false
2017-06-07 14:27:59.261718+0700 PSP for parient[802:358126] PushPlugin.register: clear badge is set to 0
2017-06-07 14:27:59.261749+0700 PSP for parient[802:358126] PushPlugin.register: better button setup
2017-06-07 14:27:59.299973+0700 PSP for parient[802:358126] GCM Sender ID (null)
2017-06-07 14:27:59.300063+0700 PSP for parient[802:358126] Using APNS Notification
2017-06-07 14:28:00.219070+0700 PSP for parient[802:357967] Push Plugin register success: <e78663bf d55dc728 be75464c 5fef8129 bc14c8ed 8df51a95 fd2135e8 3d47aec5>
2017-06-07 14:28:00.264875+0700 PSP for parient[802:357967] Device registered [object Object]
2017-06-07 14:28:01.717306+0700 PSP for parient[802:357967] active
2017-06-07 14:28:01.717430+0700 PSP for parient[802:357967] PushPlugin skip clear badge
2017-06-07 14:28:01.806969+0700 PSP for parient[802:357967] Push Plugin register success: <e78663bf d55dc728 be75464c 5fef8129 bc14c8ed 8df51a95 fd2135e8 3d47aec5>
2017-06-07 14:28:01.889623+0700 PSP for parient[802:357967] Device registered [object Object]

I test send push from webpage ionic.io, it not show. it Nothing happened.

ionic info

global packages:

@ionic/cli-utils : 1.3.0
Cordova CLI      : 7.0.1 
Ionic CLI        : 3.3.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.3.0
@ionic/cli-plugin-ionic-angular : 1.3.0
Cordova Platforms               : android 6.2.3 ios 4.4.0
Ionic Framework                 : ionic-angular 3.3.0

System:

Node       : v6.10.3
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b 
ios-deploy : not installed
ios-sim    : not installed

in app.component.ts


import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { TabsPage } from '../pages/tabs/tabs';

import { Push, PushObject, PushOptions } from '@ionic-native/push';

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage:any = TabsPage;

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private push: Push) {
    platform.ready().then(() => {

      // Push Start
      // to initialize push notifications
      const options: PushOptions = {
         android: {
             senderID: '-----'
         },
         ios: {
             alert: 'true',
             badge: true,
             sound: 'false'
         },
         windows: {}
      };

      const pushObject: PushObject = this.push.init(options);

      pushObject.on('notification').subscribe((notification: any) => console.log('Received a notification', notification));

      pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', registration));

      pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));
      // Push end


      statusBar.styleDefault();
      splashScreen.hide();
    });
  }
}

Did you replace this with your senderID?

If you want to use Ionic Push (the service on apps.ionic.io), this is the way to go: Ionic Docs - Ionic Documentation

I have sender id but I cencur sender to post

Hi frankenly,

the missing part in your implementation is saving your token to the ionic push service. As sujan12 said, if you want to use the service you gotta go with the docs here: http://docs.ionic.io/services/push/

the suggested way would be (see save in line 2):

this.push.register().then((t: PushToken) => {
  return this.push.saveToken(t);
}).then((t: PushToken) => {
  console.log('Token saved:', t.token);
});

Pitfalls: You are using push from ionic native right now, if you want to use the service you should use push from ionic-cloud instead. Just changing your implementation without changing the import will result in errors. Push from ionic-cloud is more or less a wrapper of the native push extended with mechanisms to communicate with the push service (just like the saveToken function for example).

Best regards,
sechle

Hi echle, I’ve noticed the ‘GCM Sender ID (null)’ message in my logs for iOS also, but I have set the sender ID and followed the install instructions in the Ionic Services docs, does this mean I haven’t installed the plugin correctly?

hi,

the SENDER ID is needed for Android, so i wouldnt be concerned about it on ios.

But have you tried sending push messages on your iOS device? Does it work?

Best regards

1 Like

Thanks @echle, sorry I don’t check this account often, it’s a company one, meant to send it from my personal one. I got it working eventually, can’t remember what the issue was now but I’m sure it was a silly mistake on my part… :slight_smile:

Thanks for the help!

Hi there,

I have updated my app from Ionic 2 to Ionic 3 last week and now I am running into this problem. Before it was running without problems. I’m stuck right now after 2 evenings of wrestling with this problem. Maybe you could remember wat the solution was?

I the mean time I’m going to switch to the FCM plugin now to see if that works.

Hello, this is personal account.

It sounds like your issue is different from mine, I have stayed with Ionic 2 for my builds as 3 breaks some other components I am using.

I believe my issue came down to migrating from the dev certs to the prod ones, but I’ll look back and see if I can find anything from around then that might help.

Hi, sorry for the delay. I haven’t been able to respond sooner.

I do think the issue is the same. Your info info says Ionic 3.3.0 in the first post an I have exactly the same errors.

Ik think the core issue is in these lines:
2017-06-07 14:27:53.285733+0700 PSP for parient[802:358127] libMobileGestalt MobileGestaltSupport.m:153: pid 802 (PSP for parient) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-06-07 14:27:53.285850+0700 PSP for parient[802:358127] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see rdar://problem/11744455)

I still haven’t found a solution yet. However I tried to build my ionic 2 version and there I have the same issue. Worked fine when I built the same code a few moths ago.

Seems like maybe it’s a Cordova or XCode thing…

Which type of certificate are you using to sign the app, ‘Distribution’ or ‘Development’? Also did you enable push capability?

If you are using a distribution cert then it will only work if you use TestFlight, that’s something I discovered anyway when it came time to publish. The update to Ionic 3 must just be a coincidence, did you change anything else since it worked?

I just got it all working again for another app over the weekend, no issues. The only tricky part was making sure I had all the certs in the right places.

The above line indicates to me that you do indeed have issues with the certificate you are using, as I said above try using it in TestFlight, it should work there if you are using a distribution cert, otherwise set up a dev cert with an accompanying cert for push in sandbox mode instead of production.

I do believe it is a certificate issue, but the strange thing is that I haven’t changed anything. I will try to make new certificates and also setup a new firebase app with another bundle id.