WARN: Native: tried calling PushNotification.init, but the PushNotification plugin is not installed

Hey all,
Im having this error on iOS: "WARN: Native: tried calling PushNotification.init, but the PushNotification plugin is not installed."
Does Anyone have this issue as well? please need help hehe

Obviously you are trying to use PushNotification.init, ā€œbut the PushNotification plugin is not installed.ā€. The error message is quite clear.

What did you install in your app? Ionic Native plugin? Cordova plugin?

I had to update my platforms…

ionic cordova platform update ios
ionic cordova platform update android

and then install again the plugin

sudo ionic cordova plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXX

but now when i tried to build ios, i got this error

build-debug.xcconfig line 27: Unable to find included file ā€œā€¦/pods-debug.xcconfigā€

I AM so tired of this … :smile:

That’s a iOS build problem now.

I would remove and re-add the iOS platform first. If the problem persists, run the command with --verbose.

So in the end, i removed the iOS platform then add it again WITHOUT root because I had

Cocoa cannot be installed as root

After that i got error when building and podfile… To make it work, i had to update podfile

pod repo remove master
git clone GitHub - CocoaPods/Specs: The CocoaPods Master Repo ~/.cocoapods/repos/master
pod setup

and then

pod install

I had to do that because of the plugin push i think.
Right now Im still having a issue when building but the error is just ā€œarchiving failedā€. I still can compile and launch XCode with the .xcworkspace. Launching with the . xcodeproj file will not compile lol. 3 hours yesterday to this … :slight_smile:

I’m having the same issue. Did you fix it somehow? I already tried downgrading a few libraries.

Just follow my steps.
I strongly recommend you to have all latests plugins, etc.
Good luck :slight_smile:

I found the solution putting a setTimeOut in your platform.ready:

setTimeout(()=>{

       this.initPushNotification();
       
     }, 1000);

2 weeks founding this error…

1 Like

No need of timeouts. Just put your initialization inside platform.ready() in AppComponent.

        platform.ready().then(() => {

                let options: PushOptions = {
                  
                    ios: {
                        alert: 'true',
                        badge: true,
                        sound: 'true'
                    },
                    windows: {},
                    browser: {
                        pushServiceURL: 'http://push.api.phonegap.com/v1/push'
                    }
                };

                let pushObject: PushObject = this.push.init(options);
});
2 Likes

your version of phonegap-plugin-push Plugin doesn’t support in your cordova-android version. cordova-android: 7.0.0,
try version requirement: >= cordova-android 7.1.0

i have same issue?
\ Ionic Native: tried calling Push.hasPermission, but the Push plugin is not installed.
Install the Push plugin: ā€˜ionic cordova plugin add phonegap-plugin-push’
Ionic Native: tried calling PushNotification.init, but the PushNotification plugin is not installed.

The plugin needs Platform to be ready so you must first call this.platform.ready():

this.platform.ready().then(() => {
  this.push.init(options);
  // etc...
});