phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

TypeError: Cannot use 'in' operator to search for 'SENDER_ID' in undefined #696

Closed wjputtoatkorma closed 8 years ago

wjputtoatkorma commented 8 years ago

Using phonegap-plugin-push in cordova ionic, programming with visualstudio 2015

version 1.6.0 doesn't build but gives an error like TypeError: Cannot use 'in' operator to search for 'SENDER_ID' in undefined

Anyone a clue how to fix this?

I've tried using previous version but the error stays....

macdonst commented 8 years ago

@wjputtoatkorma Um, it seems like this might be your problem:

https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md

Read the note above Android Details.

hung-doan commented 8 years ago

So what is the reason of providing a SENDER_ID when add plugin. It's so confused because I have to define it again at

var push = PushNotification.init({
    android: {
        senderID: "12345679"
    },
});
macdonst commented 8 years ago

@hungdoan2 it fixes #492 and everything is discussed in #679

wjputtoatkorma commented 8 years ago

@macdonst i followed you instructions, thnk you for your reply. Unfortunatly it did not fix the issue, I think i have made a mistake somewhere else.

here is my pakage.json:

{ "name": "Korma.888888.Werkplaats", "version": "1.0.0", "dependencies": {}, "devDependencies": { "bower": "~1.5.2", "grunt": "~0.4.5", "grunt-contrib-sass": "~0.9.2", "grunt-contrib-watch": "~0.6.1", "grunt-bowercopy": "~1.2.3", "load-grunt-tasks": "~3.2.0", "time-grunt": "~1.2.1" }, "cordovaPlugins": [ { "variables": { "SENDER_ID": "....." }, "locator": "phonegap-plugin-push" } ] }

my config.xml:

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps" id="xx.xxxx.xxxxxx" version="1.0.11" xmlns="http://www.w3.org/ns/widgets" defaultlocale="en-US" android-versionCode="">
  <name>Korma push</name>
  <description>description etc etc etc </description>
  <author href="http://cordova.io" email="dev@cordova.apache.org">Korma</author>
  <content src="index.html" />
  <access origin="*" />
  <vs:features>
    <vs:feature>https://github.com/phonegap/phonegap-plugin-push.git</vs:feature>
    <vs:feature>https://github.com/Azure/azure-mobile-services-cordova.git</vs:feature>
    <vs:feature>https://github.com/apache/cordova-plugin-statusbar.git</vs:feature>
    <vs:feature>https://github.com/apache/cordova-plugin-device.git</vs:feature>
    <vs:feature>https://github.com/apache/cordova-plugin-device.git</vs:feature>
    <vs:feature>https://github.com/peutetre/cordova-plugin-hockeyapp.git</vs:feature>
  </vs:features>
  <preference name="SplashScreen" value="screen" />
  <preference name="windows-target-version" value="8.1" />
  <!-- Support for Cordova 5.0.0 plugin system -->
  <plugin name="cordova-plugin-whitelist" version="1" />
  <plugin name="com.microsoft.azure-mobile-services" version="1.2.9" />
  <plugin name="cordova-plugin-statusbar" version="2.0.0-dev" />
  <plugin name="cordova-plugin-device" version="1.0.2-dev" />
  <plugin name="cordova-plugin-hockeyapp" version="1.2.0" />
  <platform name="ios">
    <plugin name="ios-config" version="1.0" />
  </platform>
  <allow-intent href="http://*/*" />
  <allow-intent href="https://*/*" />
  <allow-intent href="tel:*" />
  <allow-intent href="sms:*" />
  <allow-intent href="mailto:*" />
  <allow-intent href="geo:*" />
  <platform name="android">
    <allow-intent href="market:*" />
  </platform>
  <platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
  </platform>
  <platform name="android">
    <icon src="res/icons/android/icon-48-mdpi.png" density="mdpi" />
    <icon src="res/icons/android/icon-72-hdpi.png" density="hdpi" />
    <icon src="res/icons/android/icon-96-xhdpi.png" density="xhdpi" />
  </platform>
  <platform name="ios">
    <!-- iOS 8.0+ -->
    <!-- iPhone 6 Plus  -->
    <icon src="res/icons/ios/icon-60-3x.png" width="180" height="180" />
    <!-- iOS 7.0+ -->
    <!-- iPhone / iPod Touch  -->
    <icon src="res/icons/ios/icon-60.png" width="60" height="60" />
    <icon src="res/icons/ios/icon-60-2x.png" width="120" height="120" />
    <!-- iPad -->
    <icon src="res/icons/ios/icon-76.png" width="76" height="76" />
    <icon src="res/icons/ios/icon-76-2x.png" width="152" height="152" />
    <!-- iOS 6.1 -->
    <!-- Spotlight Icon -->
    <icon src="res/icons/ios/icon-40.png" width="40" height="40" />
    <icon src="res/icons/ios/icon-40-2x.png" width="80" height="80" />
    <!-- iPhone / iPod Touch -->
    <icon src="res/icons/ios/icon-57.png" width="57" height="57" />
    <icon src="res/icons/ios/icon-57-2x.png" width="114" height="114" />
    <!-- iPad -->
    <icon src="res/icons/ios/icon-72.png" width="72" height="72" />
    <icon src="res/icons/ios/icon-72-2x.png" width="144" height="144" />
    <!-- iPhone Spotlight and Settings Icon -->
    <icon src="res/icons/ios/icon-small.png" width="29" height="29" />
    <icon src="res/icons/ios/icon-small-2x.png" width="58" height="58" />
    <!-- iPad Spotlight and Settings Icon -->
    <icon src="res/icons/ios/icon-50.png" width="50" height="50" />
    <icon src="res/icons/ios/icon-50-2x.png" width="100" height="100" />
  </platform>
  <platform name="windows">
    <icon src="res/icons/windows/Square150x150Logo.scale-100.png" width="150" height="150" />
    <icon src="res/icons/windows/Square150x150Logo.scale-240.png" width="360" height="360" />
    <icon src="res/icons/windows/Square30x30Logo.scale-100.png" width="30" height="30" />
    <icon src="res/icons/windows/Square310x310Logo.scale-100.png" width="310" height="310" />
    <icon src="res/icons/windows/Square44x44Logo.scale-240.png" width="106" height="106" />
    <icon src="res/icons/windows/Square70x70Logo.scale-100.png" width="70" height="70" />
    <icon src="res/icons/windows/Square71x71Logo.scale-240.png" width="170" height="170" />
    <icon src="res/icons/windows/StoreLogo.scale-100.png" width="50" height="50" />
    <icon src="res/icons/windows/StoreLogo.scale-240.png" width="120" height="120" />
    <icon src="res/icons/windows/Wide310x150Logo.scale-100.png" width="310" height="150" />
    <icon src="res/icons/windows/Wide310x150Logo.scale-240.png" width="744" height="360" />
  </platform>
  <platform name="wp8">
    <icon src="res/icons/wp8/ApplicationIcon.png" width="62" height="62" />
    <icon src="res/icons/wp8/Background.png" width="173" height="173" />
  </platform>
  <platform name="android">
    <splash src="res/screens/android/screen-hdpi-portrait.png" density="port-hdpi" />
    <splash src="res/screens/android/screen-ldpi-portrait.png" density="port-ldpi" />
    <splash src="res/screens/android/screen-mdpi-portrait.png" density="port-mdpi" />
    <splash src="res/screens/android/screen-xhdpi-portrait.png" density="port-xhdpi" />
  </platform>
  <platform name="ios">
    <splash src="res/screens/ios/screen-iphone-portrait.png" width="320" height="480" />
    <splash src="res/screens/ios/screen-iphone-portrait-2x.png" width="640" height="960" />
    <splash src="res/screens/ios/screen-ipad-portrait.png" width="768" height="1024" />
    <splash src="res/screens/ios/screen-ipad-portrait-2x.png" width="1536" height="2048" />
    <splash src="res/screens/ios/screen-ipad-landscape.png" width="1024" height="768" />
    <splash src="res/screens/ios/screen-ipad-landscape-2x.png" width="2048" height="1536" />
    <splash src="res/screens/ios/screen-iphone-568h-2x.png" width="640" height="1136" />
    <splash src="res/screens/ios/screen-iphone-portrait-667h.png" width="750" height="1334" />
    <splash src="res/screens/ios/screen-iphone-portrait-736h.png" width="1242" height="2208" />
    <splash src="res/screens/ios/screen-iphone-landscape-736h.png" width="2208" height="1242" />
  </platform>
  <platform name="windows">
    <splash src="res/screens/windows/SplashScreen.scale-100.png" width="620" height="300" />
    <splash src="res/screens/windows/SplashScreen.scale-240.png" width="1152" height="1920" />
    <splash src="res/screens/windows/SplashScreenPhone.scale-240.png" width="1152" height="1920" />
  </platform>
  <platform name="wp8">
    <splash src="res/screens/wp8/SplashScreenImage.jpg" width="480" height="800" />
  </platform>
  <preference name="android-minSdkVersion" value="14" />
  <preference name="android-maxSdkVersion" value="22" />
  <preference name="android-targetSdkVersion" value="22" />
  <preference name="KeepRunning" value="False" />
  <preference name="ShowTitle" value="True" />
  <preference name="InAppBrowserStorageEnabled" value="False" />
  <preference name="SuppressesIncrementalRendering" value="True" />
  <preference name="Orientation" value="portrait" />
  <preference name="Fullscreen" value="False" />
  <preference name="target-device" value="handset" />
  <preference name="StatusBarStyle" value="darkcontent" />
  <preference name="DisallowOverscroll" value="true" />
  <plugin name="org.apache.cordova.inappbrowser" version="0.6.0" />
  <plugin name="phonegap-plugin-push" version="1.6.0" src="https://github.com/phonegap/phonegap-plugin-push">
    <param name="SENDER_ID" value="......." />
  </plugin>
</widget>
hung-doan commented 8 years ago

@wjputtoatkorma Did you try to reinstall the plugin ? could you capture the error screen

wjputtoatkorma commented 8 years ago

Dear hungdoan2 i have made som screenshots. Please let me know if you need more to help us out! pushpluginerror.pdf

hung-doan commented 8 years ago

@wjputtoatkorma It was reported as a bug in VS2015. I recommend to install plugin by cordova plugin install. To manage cordova plugins you can configure your config.xml Readme

https://github.com/Microsoft/cordova-docs/blob/master/articles/known-issues/known-issues-vs2015.md

wjputtoatkorma commented 8 years ago

Oh my god, cheers microsoft! Thank you very much for pointing me in that direction. I will let you know wat happens.

thank you again, Willemjan

wjputtoatkorma commented 8 years ago

@hungdoan2 , your solution did the trick for me. I had to create a new blank project and copy all the source into the new project. A few issues with installing certain plugins: specially vs:featurehttps://github.com/Azure/azure-mobile-services-cordova.git/vs:feature and vs:featurehttps://github.com/peutetre/cordova-plugin-hockeyapp.git/vs:feature needed to be installed by vs:feature (i dont know why it has to be done that way and so i dont know what that vs:feature does during build) But it works fine now.

Thank you again!

lock[bot] commented 6 years ago

This thread has been automatically locked.