Hi guys,

I get error on Pushwoosh init function using Phonegap 3.5 and xCode 5.1:

TypeError: 'undefined' is not an object (evaluating 'window.plugins.pushNotification')

Here is the code I have added to my js file:

function initPushwoosh() { var pushNotification = window.plugins.pushNotification;

           //set push notification callback before we initialize the plugin
           document.addEventListener('push-notification', function(event) {
                                     //get the notification payload
                                     var notification = event.notification;

                                     //display alert to the user for me example

                                     //clear the app badge

           //initialize the plugin
                                          pw_appid: "#########"

           //register for pushes
                                           function(status) {
                                           var deviceToken = status['deviceToken'];
                                           alert('registerDevice: ' + deviceToken);
                                           function(status) {
                                           console.warn('failed to register : ' + JSON.stringify(status));
                                           alert(JSON.stringify(['failed to register ', status]));

           //reset badges on app start


document.addEventListener("deviceready", initPushwoosh, false);

asked 17 Jul '14, 06:28
Christopher's gravatar image


Here is the steps I have taken to enable the pushwoosh before I get that error: 1- I prepared my Phonegap app as normal 3.5 enabled one. 2- I created an account in Pushwoosh and added an app there. 3- I went over Apple and Google and enabled APN and Google Cloud Messaging and added to my Pushwoosh app. 4- I installed Pushwoosh Phonegap plugin into my app using PLUGMAN. 5- I added the pushnotification.js into my index.html after the cordova.js call and before app.initialize(); 6- I went over the document for enabling Pushwoosh on Phonegap inside IOS: ....

(18 Jul '14, 06:43) Christopher Christopher's gravatar image

http://www.pushwoosh.com/programming-push-notification/ios/ios-additional-platforms/push-notification-sdk-integration-for-phonegap/ 7- I added the code mentioned above into my custom JS file onDeviceReady event. 8- Now I get this console error: TypeError: 'undefined' is not an object (evaluating 'window.plugins.pushNotification')

(18 Jul '14, 06:43) Christopher Christopher's gravatar image

I wonder if I have a problem in the plugin installation or it is a problem in the code I have written. Is the process of adding the Pushwoosh plugin via command line tool PLUGMAN and adding the js file into my html file enough? Or should I add extra stuff in my config.xml? Worth to mention that I DO NOT use Phonegap Build and am using xCode and Ios specific Phonegap platform.

(18 Jul '14, 06:43) Christopher Christopher's gravatar image


It seems that there is some kind of a bug with PlugMan: in case you install the plugin in the iOS project directory instead of PhoneGap project directory, the plugin is installed correctly, but Cordova doesn't know about it and deletes the metadata when you try to build the application.

We recommend to add plugin with the following command:

cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-3.0-plugin.git

If it doesn't help, please let us know via Contact us form

permanent link
answered 22 Jul '14, 10:37
Dmitry%20%20Dyudeev's gravatar image

Dmitry Dyudeev

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 17 Jul '14, 06:28

question was seen: 2,319 times

last updated: 22 Jul '14, 10:37