dpa99c / phonegap-launch-navigator

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

Navigation App selection not working for iOS #244

Closed madmacc closed 4 years ago

madmacc commented 4 years ago

Bug report

Current behavior: The below works as expected for Android and asks which navigation app to use.

When making the following call on iOS 13.3.1 it always tries to use apple maps which I don't have installed. It asks to take me to the App Store. I have google maps and Waze installed.

this.launchNavigator.navigate([lat, lng], { app: this.launchNavigator.APP.USER_SELECT })
  .then(
    success => console.log('Launched navigator'),
    error => console.log('Error launching navigator', error)
  );

or

this.launchNavigator.navigate([lat, lng])
  .then(
    success => console.log('Launched navigator'),
    error => console.log('Error launching navigator', error)
  );

Edit:

I also tried with the following:
 this.launchNavigator.isAppAvailable(this.launchNavigator.APP.GOOGLE_MAPS).then(isAvailable => {
    let app;
    if (isAvailable) {
      app = this.launchNavigator.APP.GOOGLE_MAPS;
    } else {
        console.warn('Google Maps not available - falling back to user selection');
        app = this.launchNavigator.APP.USER_SELECT;
    }
    this.launchNavigator.navigate([lat, lng], { app: app });
  });

And got the following logs:

To Native Cordova ->    

LaunchNavigator   

isAppAvailable   

LaunchNavigator1347868686   

["options": [google_maps]]   

2020-04-15 12:35:12.089826+1200 App[347:7443] -canOpenURL: failed for URL: "comgooglemaps://" - error: "This app is not allowed to query for scheme comgooglemaps"

⚡️  [warn] - Google Maps not available - falling back to user selection   

To Native Cordova ->    

LaunchNavigator   

availableApps   

LaunchNavigator1347868687   

["options": []]   

2020-04-15 12:35:12.095337+1200 App[347:7443] -canOpenURL: failed for URL: "citymapper://" - error: "This app is not allowed to query for scheme citymapper"

2020-04-15 12:35:12.096445+1200 App[347:7443] -canOpenURL: failed for URL: "comgooglemaps://" - error: "This app is not allowed to query for scheme comgooglemaps"

2020-04-15 12:35:12.097488+1200 App[347:7443] -canOpenURL: failed for URL: "navigon://" - error: "This app is not allowed to query for scheme navigon"

2020-04-15 12:35:12.098511+1200 App[347:7443] -canOpenURL: failed for URL: "transit://" - error: "This app is not allowed to query for scheme transit"

2020-04-15 12:35:12.099497+1200 App[347:7443] -canOpenURL: failed for URL: "waze://" - error: "This app is not allowed to query for scheme waze"

2020-04-15 12:35:12.100615+1200 App[347:7443] -canOpenURL: failed for URL: "yandexnavi://" - error: "This app is not allowed to query for scheme yandexnavi"

2020-04-15 12:35:12.101832+1200 App[347:7443] -canOpenURL: failed for URL: "uber://" - error: "This app is not allowed to query for scheme uber"

2020-04-15 12:35:12.103076+1200 App[347:7443] -canOpenURL: failed for URL: "tomtomhome://" - error: "This app is not allowed to query for scheme tomtomhome"

2020-04-15 12:35:12.104330+1200 App[347:7443] -canOpenURL: failed for URL: "com.sygic.aura://" - error: "This app is not allowed to query for scheme com.sygic.aura"

2020-04-15 12:35:12.105299+1200 App[347:7443] -canOpenURL: failed for URL: "here-route://" - error: "This app is not allowed to query for scheme here-route"

2020-04-15 12:35:12.106263+1200 App[347:7443] -canOpenURL: failed for URL: "moovit://" - error: "This app is not allowed to query for scheme moovit"

2020-04-15 12:35:12.107229+1200 App[347:7443] -canOpenURL: failed for URL: "lyft://" - error: "This app is not allowed to query for scheme lyft"

2020-04-15 12:35:12.108196+1200 App[347:7443] -canOpenURL: failed for URL: "mapsme://" - error: "This app is not allowed to query for scheme mapsme"

2020-04-15 12:35:12.109165+1200 App[347:7443] -canOpenURL: failed for URL: "cabify://" - error: "This app is not allowed to query for scheme cabify"

2020-04-15 12:35:12.110048+1200 App[347:7443] -canOpenURL: failed for URL: "baidumap://" - error: "This app is not allowed to query for scheme baidumap"

2020-04-15 12:35:12.111018+1200 App[347:7443] -canOpenURL: failed for URL: "taxis99://" - error: "This app is not allowed to query for scheme taxis99"

2020-04-15 12:35:12.111971+1200 App[347:7443] -canOpenURL: failed for URL: "iosamap://" - error: "This app is not allowed to query for scheme iosamap"

2020-04-15 12:35:12.112347+1200 App[347:7443] [Process] kill() returned unexpected error 1

To Native Cordova ->    

LaunchNavigator   

navigate   

LaunchNavigator1347868688   

["options": [-45.0274225,168.6597951, coords, <null>, <null>, none, <null>, apple_maps, driving, uri_scheme, <null>, 1]] 

Environment information Ionic:

Ionic CLI : 5.2.4 Ionic Framework : @ionic/angular 4.7.4 @angular-devkit/build-angular : 0.13.9 @angular-devkit/schematics : 7.3.9 @angular/cli : 7.3.8 @ionic/angular-toolkit : 1.5.1

Capacitor:

Capacitor CLI : 1.1.1 @capacitor/core : 1.1.1

Utility:

cordova-res : 0.9.0 native-run : not installed

System:

NodeJS : v10.17.0 (C:\Program Files\nodejs\node.exe) npm : 6.11.3 OS : Windows 10

Runtime issue

iOS build issue:

madmacc commented 4 years ago

I should have realized they needed permissions on iOS to see if the app is available. https://stackoverflow.com/a/52001534/10222449