Google Maps with geolocation plugin works find on Android but iOS - frustrating

We have an app with the google maps js API using the cordova-plugin-geolocation plugin that has always worked fine on both iOS and Android…

We just published a build with Volt.build and it works fine on Android but it’s total blank on iOS.

Below is our config.xml… any suggestions? I’ve been banding my hea doff the wall over here for days hehehe Thanks!

   <preference name="cordova-ios" version="4.5.4" />
      <preference name="phonegap-version" value="cli-9.0.0" />
    <preference name="AndroidPersistentFileLocation" value="Compatibility" />
    <preference name="SplashScreen" value="splash" />
    <preference name="SplashScreenDelay" value="8000" />
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="android-minSdkVersion" value="19" />
    <preference name="android-targetSdkVersion" value="28" />
    <preference name="StatusBarOverlaysWebView" value="false" />
    <preference name="StatusBarBackgroundColor" value="#000000" />
    <preference name="StatusBarStyle" value="lightcontent" />
     <preference name="android-installLocation" value="auto"/>
    <access origin="*" />
    <access launch-external="yes" origin="tel:*" />
    <access launch-external="yes" origin="geo:*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-intent href="tel:*" />
    <access origin="*" subdomains="true"/>
       <access origin="facebook.com" subdomains="true" />
        <access origin="*.fbcdn.net" />
         <access origin="*.akamaihd.net" />
           <access origin="*.googleapis.com/*" subdomains="true" />
               <access origin="*.gstatic.com/*" subdomains="true" />
                  <access origin="*.google.com/*" subdomains="true" />
                      <access origin="*.googleusercontent.com/*" subdomains="true" />
                      <access origin="googleapis.com" subdomains="true"/>
    <plugin name="cordova-plugin-apprate" />
    <plugin name="cordova-plugin-device" />
    <plugin name="cordova-plugin-dialogs"  />
    <plugin name="cordova-plugin-file"  />
    <plugin name="cordova-plugin-file-transfer"  />
 <plugin name="cordova-plugin-geolocation" spec="2.4.3" />
    <plugin name="cordova-plugin-globalization"  />
    <plugin name="cordova-plugin-inappbrowser"  />
    <plugin name="cordova-plugin-splashscreen" />
    <plugin name="cordova-plugin-statusbar" />
    <plugin name="cordova-plugin-whitelist" />
    <platform name="android">
        <icon density="ldpi" src="res/icon/android/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="res/icon/android/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="res/icon/android/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="res/icon/android/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="res/icon/android/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="res/icon/android/drawable-xxxhdpi-icon.png" />
        <splash density="port-ldpi" src="res/screen/android/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="res/screen/android/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="res/screen/android/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="res/screen/android/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="res/screen/android/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="res/screen/android/drawable-port-xxxhdpi-screen.png" />
        <splash src="res/screen/android/splash.png" />
    </platform>
    <platform name="ios">
      <edit-config target="NSLocationAlwaysUsageDescription" file="*-Info.plist" mode="overwrite">
    <string>Allow the app to know your location</string>
  </edit-config>
     <icon src="res/icon/ios/icon-1024.png" width="1024" height="1024"/>
<icon src="res/icon/ios/icon-small.png" width="29" height="29"/>
<icon src="res/icon/ios/icon-small@2x.png" width="58" height="58"/>
<icon src="res/icon/ios/icon-small@3x.png" width="87" height="87"/>
<icon src="res/icon/ios/icon-small-40.png" width="40" height="40"/>
<icon src="res/icon/ios/icon-small-40@2x.png" width="80" height="80"/>
<icon src="res/icon/ios/icon-small-40@3x.png" width="120" height="120"/>
<icon src="res/icon/ios/icon-small-50.png" width="50" height="50"/>
<icon src="res/icon/ios/icon-small-50@2x.png" width="100" height="100"/>
<icon src="res/icon/ios/icon.png" width="57" height="57"/>
<icon src="res/icon/ios/icon@2x.png" width="114" height="114"/>
<icon src="res/icon/ios/icon-60.png" width="60" height="60"/>
<icon src="res/icon/ios/icon-60@2x.png" width="120" height="120"/>
<icon src="res/icon/ios/icon-60@3x.png" width="180" height="180"/>
<icon src="res/icon/ios/icon-72.png" width="72" height="72"/>
<icon src="res/icon/ios/icon-72@2x.png" width="144" height="144"/>
<icon src="res/icon/ios/icon-76.png" width="76" height="76"/>
<icon src="res/icon/ios/icon-76@2x.png" width="152" height="152"/>
<icon src="res/icon/ios/icon-167.png" width="167" height="167"/>
<icon src="res/icon/ios/icon-83.5@2x.png" width="167" height="167"/>
<!--  Storyboard portrait  -->
    <splash src="res/screen/ios/Default@2x~iphone~anyany.png"/>
<splash src="res/screen/ios/Default@2x~iphone~comany.png"/>
<splash src="res/screen/ios/Default@3x~iphone~anyany.png"/>
<splash src="res/screen/ios/Default@3x~iphone~comany.png"/>
<splash src="res/screen/ios/Default@2x~ipad~anyany.png"/>
<splash src="res/screen/ios/Default@2x~ipad~comany.png"/>
    </platform>
    <platform name="wp8">
        <icon height="99" platform="wp8" src="res/icon/wp8/ApplicationIcon.png" width="99" />
        <icon height="159" platform="wp8" src="res/icon/wp8/Background.png" width="159" />
        <splash height="1280" platform="wp8" src="res/screen/wp8/screen-portrait.jpg" width="768" />
    </platform>
    <platform name="windows">
        <icon height="150" platform="windows" src="res/icon/windows/Square150x150Logo.scale-100.png" width="150" />
        <icon height="30" platform="windows" src="res/icon/windows/Square30x30Logo.scale-100.png" width="30" />
        <icon height="50" platform="windows" src="res/icon/windows/StoreLogo.scale-100.png" width="50" />
        <splash height="300" platform="windows" src="res/screen/windows/SplashScreen.scale-100.png" width="620" />
        <icon height="120" platform="windows" src="res/icon/windows/StoreLogo.scale-240.png" width="120" />
        <icon height="44" platform="windows" src="res/icon/windows/Square44x44Logo.scale-100.png" width="44" />
        <icon height="106" platform="windows" src="res/icon/windows/Square44x44Logo.scale-240.png" width="106" />
        <icon height="70" platform="windows" src="res/icon/windows/Square70x70Logo.scale-100.png" width="70" />
        <icon height="71" platform="windows" src="res/icon/windows/Square71x71Logo.scale-100.png" width="71" />
        <icon height="170" platform="windows" src="res/icon/windows/Square71x71Logo.scale-240.png" width="170" />
        <icon height="360" platform="windows" src="res/icon/windows/Square150x150Logo.scale-240.png" width="360" />
        <icon height="310" platform="windows" src="res/icon/windows/Square310x310Logo.scale-100.png" width="310" />
        <icon height="150" platform="windows" src="res/icon/windows/Wide310x150Logo.scale-100.png" width="310" />
        <icon height="360" platform="windows" src="res/icon/windows/Wide310x150Logo.scale-240.png" width="744" />
        <splash height="1920" platform="windows" src="res/screen/windows/SplashScreenPhone.scale-240.png" width="1152" />
    </platform>
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <allow-navigation href="http://*/*" />
    <allow-navigation href="https://*/*" />

    <!-- Default splash screen -->
<splash src="splash.png" />
    <feature name="http://api.phonegap.com/1.0/geolocation"/>
</widget>

Are there any messages if you hook up your Mac and Safari?

two things:

  1. This is an FYI: The geolocation plugin only manages permissions. It no longer does any GPS work as that is all handled by the webkit engine in the respective platforms as per the HTML spec.
  2. I didn’t see the google maps plugin in your config.xml. If you’re using the javascript api you will very quickly hit your free limit and be billed plus it’s very hard to secure your token. If you’re using the googlemaps plugin there are a TON of issues with it especially the later versions. 2.6.0 is the latest that I was able to get working across both platforms.

Essentially your config.xml looks like this:

  <plugin name="cordova-plugin-googlemaps" spec="2.6.0">
    <variable name="PLAY_SERVICES_VERSION" value="15.0.1" />
    <variable name="ANDROID_SUPPORT_V4_VERSION" value="27.1.1" />
    <variable value="ABCdefGHI123............" name="API_KEY_FOR_ANDROID" />
    <variable value="ABCdefGHI............" name="API_KEY_FOR_IOS" />
  </plugin>

Thanks. Permissions was it.

This was added and now it works…

  <edit-config target="NSLocationAlwaysUsageDescription" file="*-Info.plist" mode="overwrite">
<string>Allow the app to know your location</string>

We already have a token for it and its working fine now.