iOS Geolocation issue

How can I add this variable to the phonegap config file? I get an error regarding malformed xml when I try to insert it into the plugin line.

My iOS geolocation is not working in iOS 10.

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

Here is what I have determined…

I have added the CDVLocation param

`

`

I have also added the NSLocation…

<gap:config-file platform="ios" parent="NSLocationWhenInUseUsageDescription" mode="replace"> <string>App Name</string> </gap:config-file>

I am not getting the current location unless I close the app and reopen. Not sure why the geolocation is not working in iOS? Ideas?

Robb

I am currently seeing the geolocation not working when in the app, if I exit and return the position is captured. Is this somehow being blocked by CSP? I have tried adding to the extra headers but it does not seem to help fix the issue.

Suggestions welcome.

This question has been moved to the PhoneGap area.

George Henne
NS BASIC Corporation
http://www.nsbasic.com

<gap:plugin name=“cordova-plugin-geolocation” source=“npm” >

</gap:plugin>

George Henne
NS BASIC Corporation
http://www.nsbasic.com

I have exactly the same problem as you on iOS
I noticed that deviceready is not firing at all until you close the application and open again. (I put a msgbox just to make sure, never gets shown until i close the app and open again, then it is shown)
Not only that, it ask if you want to use Location Service when you exit the application, but if you look in location services, at least in my case, my application is not listed.

It was working OK before. I don;t think it has anything to do with the iOS version because old Builds work OK.

The issue had to do with the CSP setting the value properly as well as other config.xml settings.

default-src gap: file://* *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *; media-src *; img-src data: *

I also added param name in the config.xml

`

`

and these gap settings

<gap:config-file platform="ios" parent="NSLocationWhenInUseUsageDescription" mode="replace"> <string>Mitzvah Keeper Pro</string> </gap:config-file> <gap:config-file platform="ios" parent="NSLocationAlwaysUsageDescription" mode="replace"> <string>Mitzvah Keeper Pro</string> </gap:config-file>

yea, I added:
default-src ‘self’ gap://ready; style-src * ‘unsafe-inline’; script-src * ‘unsafe-inline’ ‘unsafe-eval’; media-src * blob:; img-src * data:; connect-src *;
to contentSecurityPolicy and now deviceready fires right away and i get asked if I want to allow access to Location and evrything is working like a charm again.

THANKS!!!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.