Closed svarughese91 closed 5 years ago
The userChoice
object works fine (see screenshot below) - you can confirm this by building and running the AdvancedExample project in the example repo which makes use of userChoice
.
The most likely cause of the error is the scope of this
in your code is causing this.launchNavigator
to be undefined - you can confirm this by debugging your code while it's running.
@dpa99c how would i be able to access launchNavigator without using "this"?
Presumably you are using the Ionic Typescript wrapper for this plugin in which case you are not interacting directly with the plugin API.
The Cordova plugin API itself is pure Javascript, so as documented the plugin API is exposed via the global launchnavigator
namespace on the window
object:
window.launchnavigator....
or
launchnavigator...
window['launchnavigator'] works! Thanks so much
I'm submitting a ... (check one with "x"):
Bug report
Current behavior:
When I try to access if the user has selected a preferred nav app or try to set it I get a undefined error: TypeError: undefined is not an object (evaluating 'this.launchNavigator.appSelection.userChoice')
I pull this info directly from the plugin so not sure why it would be undefined. -->
Expected behavior:
This should be giving me a true or false to see if the user has selected a prefered nav app:
this.launchNavigator.appSelection.userChoice.exists((doesExist) => {})
Steps to reproduce:Environment information
cordova -v
8.0.0cordova platform ls
Installed platforms: ios 4.5.4 Available platforms: android ~7.0.0 browser ~5.0.1 osx ~4.0.1 windows ~5.0.0 www ^3.12.0cordova plugin ls
sw_vers
winver
Runtime issue
Device details
OS details
Node JS version
node -v
v9.2.1XCode version 9.4.1
If using an [Ionic Native Typescript wrapper]() for this plugin:
Ionic environment info
ionic info
cli packages: (/Users/shawnvarughese/Documents/Test/node_modules)@ionic/cli-utils : 1.19.2 ionic (Ionic CLI) : 3.20.0
global packages:
local packages:
System:
Environment Variables:
Misc:
npm list | grep "@ionic-native"