Ionic Pro: iOS geolocation error


Hi all, we’re having an error with the geolocation plugin on our build on ionic pro, but only for iOS.
The message that’s returned with the error is “Origin does not have permission to use Geolocation service”

It’s worth noting as well, that we don’t receive any prompt to grant the app permission to use user location.

(version details
ionic info

cli packages: (/Users/JD/WebstormProjects/SkateSpot_Lite/node_modules)

@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:

Cordova CLI : 7.0.1
local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms : android 6.1.2 browser 4.1.0 ios 4.3.1
Ionic Framework : ionic-angular 3.6.1

Android SDK Tools : 25.2.5
Node : v6.11.0
npm : 5.4.2
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002


What is your ionic cordova plugin list?
What do you mean by “geolocation service”? What is the code behind that?


By “Geolocation service” I mean the Ionic Native Geolocation plugin

The following is our plugin list
"cordova-plugin-add-swift-support 1.7.0 "AddSwiftSupport"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-nativegeocoder 2.0.2 "NativeGeocoder"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-sqlite-storage 2.0.4 “Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 “Keyboard””


Which one exactly? Post a link to the plugin please.
Does this request any URL? The error message indicates a missing “Origin” header.


The plugin found here

It’s also in the docs for Ionic Pro as a supported plugin.
I find it strange that it would be missing the “Origin” header only on Ionic Pro for iOS, since it works on Ionic Pro for Android, Android APKs and iOS IPAs


I don’t even understand which URL it should be requesting. Can you check that via debugging in the dev tools?


I can’t discern the URL being requested in my dev environment, the plugin seems rather sophisticated and may not be calling a URL until it’s on the Ionic Pro environment, in which case I can’t debug it to find out.
From their own docs
"Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs. There is no guarantee that the API returns the device’s actual location."


Also from their documentation

"iOS Quirks

Since iOS 10 it’s mandatory to add a NSLocationWhenInUseUsageDescription entry in the info.plist.

NSLocationWhenInUseUsageDescription describes the reason that the app accesses the user’s location. When the system prompts the user to allow access, this string is displayed as part of the dialog box. To add this entry you can pass the variable GEOLOCATION_USAGE_DESCRIPTION on plugin install.

Example: cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION=“your usage message”

If you don’t pass the variable, the plugin will add an empty string as value."

I’m going to attempt to re-install with this flag and see if that solves the issue


No luck after adding to the info.plist


Why not? Ionic Pro builds as you would do locally.
Follow these instructions here to debug the problem in Safari dev tools: Look at the console and network tabs for errors.

Or are you talking about Ionic View?


I got Problems with the Geolocations Plugin too, after updating from Ionic View to Ionic Pro. Trying to use it results in freezing of the Ionic Pro app, testing the same code via Xcode and Deploy it directly works fine. So something is wrong for sure. I didnt know that its possible to debug Apps running inside Ionic Pro over Safari, i will have a look at that method.

Edit: if i use link the same project to the old Ionic View again and do ionic upload, it works fine too.


Hey did somebody got a solution regarding this? Im having the exact same problem. No popup to allow location on iOS and getting the geolocation.getcurrentlocation throws an error : Origin does not have permission to use Geolocation service

Hope you can help.