Closed raymondtri closed 6 years ago
That error looks to be raised by this line of code.
The start parameter is expected to be either an address string, a lat/lon string in the format "lat,lon"
or an array in the format [lat,lon]
.
The only way I can see that error being raised is if an object (rather than an array) was passed as the start argument, since the above condition if(typeof(options.start) === "object")
would evaluate to true but join()
is not a member function of type object
, only of type array
.
For example, this would cause that error:
launchnavigator.navigate(destination, {
start: {}
});
There should probably be some better type checking on the inputs to throw a more meaningful error if the wrong type is passed in as an argument.
I'll get you a more detailed explanation here a bit later today, thanks for the quick reply!
I am not passing a start parameter, just the LaunchNavigatorOptions = {};
@raymondtri
Is a start argument required?
No.
What is the default type of the start parameter in LaunchNavigatorOptions? I am just passing an empty array.
LaunchNavigatorOptions
is part of the Ionic Native Typescript wrapper around this plugin and as such is not under direct control of this plugin. From the looks of their code the default type is string | number[]
.
However, it may be that the compiled JS is wrongly passing an empty object rather than array when start is not defined. The easiest way to check would be to connect Safari Web Inspector to the webview and debug it by placing some breakpoints.
This error only happens with IOS which is strange, here is the code I am calling to activate launchnavigator:
launchNativeMaps(lat, lng){
let options: LaunchNavigatorOptions = {};
this.launchNavigator.navigate([lat, lng], options);
}
I then receive the error:
Error: Uncaught (in promise): TypeError: options.start.join is not a function. (In 'options.start.join(",")', 'options.start.join' is undefined) navigate@file:///var/containers/Bundle/Application/7B16B597-B5AF-4F57-B7CB-FDB6E75B7CD4/Socialite.app/www/plugins/uk.c...
Any thoughts?