hoerresb / WifiWizard

A Cordova plugin for managing Wifi networks
Apache License 2.0
205 stars 176 forks source link

Error calling addNetwork #40

Closed atkulp closed 9 years ago

atkulp commented 9 years ago

I call formatWifiConfig to create the configuration, then addNetwork. I get:

Uncaught TypeError: Object # has no method 'trim' in WifiWizard.js on line 76.

Is this a known problem?

hoerresb commented 9 years ago

Thanks for pointing this out. I have yet to run into this error. Are you passing the formatted config as an argument in addNetwork? Ex,

               var device_wifi = WifiWizard.formatWifiConfig('ssid', 'password', 'WPA');
                // pass in formatted config to addNework 
                WifiWizard.addNetwork(device_wifi, function (win) {
                   // add network succeeded. 
                }, function (fail) {
                  // add network failed
                });
atkulp commented 9 years ago

I figured it out. I was passing the JSON config object to the connectNetwork() call instead of just the ssid. All good now!

On Mon, Aug 31, 2015 at 11:19 AM, hoerresb notifications@github.com wrote:

Thanks for pointing this out. I have yet to run into this error. Are you passing the formatted config as an argument in addNetwork? Ex,

           var device_wifi = WifiWizard.formatWifiConfig('ssid', 'password', 'WPA');
            // pass in formatted config to addNework
            WifiWizard.addNetwork(device_wifi, function (win) {
               // add network succeeded.
            }, function (fail) {
              // add network failed
            });

— Reply to this email directly or view it on GitHub https://github.com/parsonsmatt/WifiWizard/issues/40#issuecomment-136451663 .

hoerresb commented 9 years ago

Glad you figured it out. I'm going to make a note of this as we should probably check to make sure the argument being passed in is a string.