dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 131 forks source link

Error: Can't find variable: launchnavigator #115

Closed karneshkumar closed 7 years ago

karneshkumar commented 7 years ago

Hi,

plugin is working fine in android, but it's giving above error into iOS console.

I have followed instruction as given in below links.

  1. http://ngcordova.com/docs/plugins/launchNavigator
  2. https://github.com/dpa99c/phonegap-launch-navigator

I have also take reference from the your example every time giving the same error. please help me out.

Cordova CLI: 5.3.3 iOS Version: 10.0.2 iPhone: 5S OSX: 10.9.5

building app through visual studio remote agent

dpa99c commented 7 years ago

Error: Can't find variable: launchnavigator

This error is most often caused by referencing the plugin before the deviceready event has fired, since Cordova loads the JS components of plugins dynamically at runtime.

Please see the example project for illustration of correct usage.

karneshkumar commented 7 years ago

but this error am not getting on device ready. as you can see attach the screen shot. there is are fields. After specifying source and destination location. "Get Route" Button is place, where am getting the error.

img_0091

Code Snippet

        $cordovaLaunchNavigator.navigate(dest, {
            start: [$scope.navigate.fromAddress.lat, $scope.navigate.fromAddress.long],
            enableDebug: true
        }).then(function () {
            alert("Navigator launched");
        }, function (err) {
            alert(err);
        });

screen shot 2017-03-03 at 2 30 33 pm

dpa99c commented 7 years ago

The error is due to the fact that the plugin JS API object cannot be found. This can be due to referencing it before the plugin is loaded or because the plugin is not installed in the project.

Since you are using the Ionic Native wrapper to reference the plugin, make sure you have also manually installed the plugin:

$ ionic plugin add uk.co.workingedge.phonegap.plugin.launchnavigator

See the Ionic example in the example project for a working example of how to use the plugin with Ionic Native.