dpa99c / phonegap-launch-navigator

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

isAppAvailable method is not working in iOS #133

Closed Krishna25Vrinsoft closed 7 years ago

Krishna25Vrinsoft commented 7 years ago

launchnavigator.isAppAvailable(application, function (isAvailable) { if (!isAvailable) { application = launchnavigator.APP.GOOGLE_MAPS; } launchnavigator.navigate(coords, { successCallback: function () { console.log("Launched navigator app"); }, errorCallback: function (err) { console.log("Error launching navigator app: " + err); }, app: application, transportMode: launchnavigator.TRANSPORT_MODE.DRIVING, launchMode: launchnavigator.LAUNCH_MODE.MAPS }); });

This is my code. I got bellow error when run in iOS. TypeError: undefined is not an object (evaluating 'launchnavigator.LAUNCH_MODE.MAPS')

dpa99c commented 7 years ago

Launch Mode is only available on Android, so not defined in the iOS version of the plugin. You can eliminate the error with:

launchMode: launchnavigator.LAUNCH_MODE ? launchnavigator.LAUNCH_MODE.MAPS : null
Krishna25Vrinsoft commented 7 years ago

Yes. Thanks a lot

dpa99c commented 7 years ago

I will define launchnavigator.LAUNCH_MODE as an empty object on iOS and Windows in the next release, so launchnavigator.LAUNCH_MODE.MAPS will evaluate to undefined without raising an exception.