dpa99c / phonegap-launch-navigator

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

App crashes #139

Closed TC-42-54 closed 7 years ago

TC-42-54 commented 7 years ago

Hello, I got a crash in IOS when I let the user select his navigate App. This is how I call the navigate option : launchnavigator.navigate([dest.lat, dest.lng], { start: start, appSelectionList: [ launchnavigator.APP.APPLE_MAPS, launchnavigator.APP.GOOGLE_MAPS ] });

I got this message from xcode :

canOpenURL: failed for URL: "citymapper://" - error: "L’opération n’a pas pu s’achever. (OSStatus erreur -10814.)" 2017-07-13 09:03:30.053520+0200 VosgesEmoi[2264:879595] -canOpenURL: failed for URL: "navigon://" - error: "L’opération n’a pas pu s’achever. (OSStatus erreur -10814.)" 2017-07-13 09:03:30.054099+0200 VosgesEmoi[2264:879595] -canOpenURL: failed for URL: "transit://" - error: "L’opération n’a pas pu s’achever. (OSStatus erreur -10814.)" 2017-07-13 09:03:30.054646+0200 VosgesEmoi[2264:879595] -canOpenURL: failed for URL: "tomtomhome://" - error: "L’opération n’a pas pu s’achever. (OSStatus erreur -10814.)" 2017-07-13 09:03:30.055148+0200 VosgesEmoi[2264:879595] -canOpenURL: failed for URL: "uber://" - error: "L’opération n’a pas pu s’achever. (OSStatus erreur -10814.)" 2017-07-13 09:03:30.055642+0200 VosgesEmoi[2264:879595] -canOpenURL: failed for URL: "waze://" - error: "L’opération n’a pas pu s’achever. (OSStatus erreur -10814.)" 2017-07-13 09:03:30.056178+0200 VosgesEmoi[2264:879595] -canOpenURL: failed for URL: "yandexnavi://" - error: "L’opération n’a pas pu s’achever. (OSStatus erreur -10814.)" 2017-07-13 09:03:30.056714+0200 VosgesEmoi[2264:879595] -canOpenURL: failed for URL: "com.sygic.aura://" - error: "L’opération n’a pas pu s’achever. (OSStatus erreur -10814.)" 2017-07-13 09:03:30.057339+0200 VosgesEmoi[2264:879595] -canOpenURL: failed for URL: "here-route://" - error: "L’opération n’a pas pu s’achever. (OSStatus erreur -10814.)" 2017-07-13 09:03:30.058060+0200 VosgesEmoi[2264:879595] -canOpenURL: failed for URL: "moovit://" - error: "L’opération n’a pas pu s’achever. (OSStatus erreur -10814.)" 2017-07-13 09:03:30.058623+0200 VosgesEmoi[2264:879595] THREAD WARNING: ['LaunchNavigator'] took '10.336182' ms. Plugin should use a background thread.

dpa99c commented 7 years ago

These messages:

canOpenURL: failed for URL: "citymapper://" - error: "L’opération n’a pas pu s’achever. (OSStatus erreur -10814.)"

are automated messages generated by the native canOpenURL function when the plugin attempts to detect which apps are installed. The only way this can be done on iOS is to try to invoke the associated URL scheme for the app. If it succeeds, we know the app is installed. If it fails, we know the app is not installed on the device and also a message like this is generated in the Xcode console output.

They do not indicate something has gone wrong, neither does anything else in your log output. Did the requested app actually launch? If there was a native crash, can you post the stack trace that will display in the Xcode debugger pane?

Also, try building+running one of the apps in the example project eliminate the possibility of a bug in your implementation.

TC-42-54 commented 7 years ago

This is the error message I get in the console when the app crashes :

`WARNING: ['LaunchNavigator'] took '14.869873' ms. Plugin should use a background thread. 2017-07-13 13:35:10.708367+0200 VosgesEmoi[2418:921684] *** Assertion failure in -[UIAlertController addAction:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3600.8.1/UIAlertController.m:190

2017-07-13 13:35:10.711712+0200 VosgesEmoi[2418:921684] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIAlertController can only have one action with a style of UIAlertActionStyleCancel'

*** First throw call stack: (0x1927a6fe0 0x191208538 0x1927a6eb4 0x19323e720 0x198d744f4 0x10009afe4 0x10020da50 0x10020da10 0x10021b990 0x10021d630 0x10021d39c 0x191867100 0x191866cac) libc++abi.dylib: terminating with uncaught exception of type NSException`

It shows me this line of code in " ActionSheet.m " : [self.alertController addAction:cancelAction];

dpa99c commented 7 years ago

That error is occurring within cordova-plugin-actionsheet on which this plugin has a dependency in order to display the list of apps to the user.

UIAlertController can only have one action with a style of UIAlertActionStyleCancel

That suggests to me a possible cause is a conflict with another plugin your project: can you list which other plugins you have and what version of iOS you are testing on?

You can confirm this plugin works OK in isolation by building+running the example projects

TC-42-54 commented 7 years ago

I'm using an iPhone 6s with IOS 10.3.2 installed, Your examples wokrs perfectly. The crash occur after I use the plugin into m app, only when you have multiple apps choices.

There are my plugin list : `

<plugin name="cordova-plugin-camera" spec="~2.4.1" />

<plugin name="cordova-plugin-compat" spec="~1.1.0" />

<plugin name="cordova-plugin-console" spec="~1.0.7" />

<plugin name="cordova-plugin-device" spec="~1.1.6" />

<plugin name="cordova-plugin-device-motion" spec="~1.2.5" />

<plugin name="cordova-plugin-device-orientation" spec="~1.0.7" />

<plugin name="cordova-plugin-dialogs" spec="~1.3.3" />

<plugin name="cordova-plugin-file" spec="~4.3.3" />

<plugin name="cordova-plugin-file-transfer" spec="~1.6.3" />

<plugin name="cordova-plugin-geolocation" spec="~2.4.3" />

<plugin name="cordova-plugin-globalization" spec="~1.0.7" />

<plugin name="cordova-plugin-inappbrowser" spec="~1.7.1" />

<plugin name="cordova-plugin-media" spec="~3.0.1" />

<plugin name="cordova-plugin-network-information" spec="~1.3.3" />

<plugin name="cordova-plugin-phonecaller" spec="~0.0.2" />

<plugin name="cordova-plugin-statusbar" spec="~2.2.3" />

<plugin name="cordova-plugin-vibration" spec="~2.1.5" />

<plugin name="cordova-plugin-whitelist" spec="~1.3.2" />

<plugin name="cordova-plugin-x-socialsharing" spec="https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git" />

<plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" spec="~3.2.2" />`
dpa99c commented 7 years ago

Almost certainly the problem is caused by the actionsheet plugin conflicting with another of those plugins.

Your best course of action is to find out which plugin is conflicting by a process of elimination and open an issue against both actionsheet and the conflicting plugin.

I'm closing this issue because the bug does not lie within this plugin's source code, but within one of its dependencies, so there's nothing that can be done from within this plugin to resolve the issue.

TC-42-54 commented 7 years ago

So, I just deleted your plugin and reinstalled it again and all is fine, no crashes anymore !

Thanks for your help,

Thomas Chezieres