IOS 8 and PG Geolocation plugin not getting users current location

2,868 views
Skip to first unread message

Karl Söderberg

unread,
Sep 3, 2014, 10:02:10 AM9/3/14
to phon...@googlegroups.com
IOS 8 and PG Geolocation plugin not getting users current location.

On IOS 7 everything works fine but in IOS 8 the function navigator.geolocation.getCurrentPosition does not work.

Im now on all of the latest builds but it also works on older builds with IOS 7.

my current specs are:

cordova / phonegap version 3.5.0


org.apache.cordova.geolocation 0.3.9


Xcode Version 6.0 Beta 7


IOS 8.0 Beta 5

Shazron

unread,
Sep 3, 2014, 6:43:41 PM9/3/14
to phonegap
Yup, known issue. The plugin has to be patched to support iOS 8, since in iOS 8 there are new API functions to request geolocation permission. Work is in progress.


--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shazron

unread,
Sep 3, 2014, 7:37:38 PM9/3/14
to phonegap
This should be fixed in the source now:

Daniel Zet

unread,
Sep 10, 2014, 4:02:11 PM9/10/14
to phon...@googlegroups.com
I tried that but after I installed the plugin I get the following error:

clang: error: no such file or directory: '/Users/danielzielinski/Desktop/fimpl/platforms/ios/fimpl/Plugins/com.google.cordova.admob/CDVAdMob.m'

clang: error: no input files

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1



any suggestions? 

Shazron

unread,
Sep 12, 2014, 3:19:55 PM9/12/14
to phonegap
This has nothing to do with the Geo plugin -- looks like your admob plugin is missing, try to reinstall it.

--
Message has been deleted

Daniel Zet

unread,
Sep 13, 2014, 7:53:06 AM9/13/14
to phon...@googlegroups.com
Ooooops ;)

Meanwhile I set up the project from scratch and installed the suggested geo plugin - no success - its just not working, same build works under iOS7.
At iOS8 I can't access the success function.

Rod Knowlton

unread,
Sep 14, 2014, 10:10:47 PM9/14/14
to phon...@googlegroups.com
With Cordova 3.5 and Xcode 6, I had to manually add CDVLocation.m to the Build Phases -> Compile Sources.

Ronald K

unread,
Sep 16, 2014, 11:09:30 AM9/16/14
to phon...@googlegroups.com
That happens to me whenever I remove any plugin and than add it again.

Op maandag 15 september 2014 04:10:47 UTC+2 schreef Rod Knowlton:

Daniela Ferrai

unread,
Sep 21, 2014, 11:03:07 AM9/21/14
to phon...@googlegroups.com
Hi Guys,

I'm having the same issue. Geolocation on iOS8 is failing. I do get the permission request, but immediately after location failed.
I've created a new project  from scratch installing the plugins as mentioned in this thread.

The log says the following...

2014-09-21 15:54:51.537 WalkIshica[12780:135346] THREAD WARNING: ['Geolocation'] took '186.580078' ms. Plugin should use a background thread.
2014-09-21 15:54:54.044 WalkIshica[12780:135346] locationManager::didFailWithError (null)
2014-09-21 15:54:54.199 WalkIshica[12780:135346] THREAD WARNING: ['Notification'] took '150.541992' ms. Plugin should use a background thread.
2014-09-21 15:55:07.514 WalkIshica[12780:135346] locationManager::didFailWithError (null)
2014-09-21 15:55:20.882 WalkIshica[12780:135346] locationManager::didFailWithError (null)
2014-09-21 16:00:55.421 WalkIshica[12780:135346] locationManager::didFailWithError (null)


Y'

Alex Lazar

unread,
Sep 24, 2014, 12:53:46 PM9/24/14
to phon...@googlegroups.com

So the steps to handle this issues based on what i have tried and it worked are:


1) Upgrade Cordova to the latest (3.6.0 i guess is now).
   $ sudo npm update -g cordova

2) Go to your cordova project and run this:
   $ cordova platform update ios

3) Find CDVCommandDelegateImpl.h and add the following line of code:
- (BOOL)execute:(CDVInvokedUrlCommand*)command;

4) Find CDVCommandDelegateImpl.h and add this:
- (BOOL)execute:(CDVInvokedUrlCommand*)command
{
    return [_commandQueue execute:command];
}

5) Then look for CDVLocation.m and paste the content from this one: https://github.com/apache/cordova-plugin-geolocation/blob/master/src/ios/CDVLocation.m

6)Then look for CDVLocation.h and paste the content from this one: https://github.com/apache/cordova-plugin-geolocation/blob/master/src/ios/CDVLocation.h

7) Go the the -Info.plist file or on the Info section of your project and add NSLocationAlwaysUsageDescription  as a Boolean set to Yes property. You can also use NSLocationWhenInUseUsageDescription  if it's more a fit on your app(check CDVLocation.m plugin file lines 126-139). iOS8 has now these options for allowing an app to use the current location. That's why i guess old cordova plugin failed here.

8) It should work now!

Have fun.

Mahendra Sena

unread,
Sep 30, 2014, 9:09:27 AM9/30/14
to phon...@googlegroups.com
estou com um problema no meu aplicativo phonegap depois da atualização do ios 8. 
Ele roda no simulador, mas no celular ele roda apenas uma vez e depois que saio ele trava. 
Atualizei o phonegap e nada.
Message has been deleted

Tim Badaczewski

unread,
Oct 3, 2014, 9:33:40 AM10/3/14
to phon...@googlegroups.com
At the base of this article a guy says to put a "gap:config-file" reference in your PhoneGap Build config.xml file, this worked for me!


<gap:config-file platform="ios" parent="NSLocationAlwaysUsageDescription" overwrite="false"> 
<array> 
<string>Allow GPS</string> 
</array> 
</gap:config-file>

David Norris

unread,
Oct 10, 2014, 12:35:02 PM10/10/14
to phon...@googlegroups.com
PhoneGap Build Fix for developers below (but this needs to be addressed by PhoneGap/Plugin team): 
I noticed that geolocation stopped working in my app on iOS 8. Below is a fix I submitted on another board that helped others and myself get geolocation working with PhoneGap Build 3.6.3, the new geolocation plugin (0.3.10) and iOS 8.0.2 (see below). I believe this needs to be addressed by the PhoneGap Build team: 

Apparently "NSLocationAlwaysUsageDescription" needs to be in the Info.plist file and after examining the results from PhoneGap Build and the new geolocation plugin ("0.3.10"), it is missing. iOS 8 changed the way permissions and geolocation work. So you need to add NSLocationAlwaysUsageDescription to the Info.plist file. To do this we had to add the following in our config.xml: 

<gap:config-file platform="ios" parent="NSLocationAlwaysUsageDescription" overwrite="false"></gap:config-file> 

This fixed the issue for many of us for geolocation (app never asking for permissions and therefore never getting GPS data). 

Can we have someone from the PhoneGap Build/Plugin team look into this? This is a very difficult problem to resolve for most developers and not something we had to address before. 

Thank you. 

David Norris 

On Wednesday, September 3, 2014 10:02:10 AM UTC-4, Karl Söderberg wrote:

David Norris

unread,
Oct 10, 2014, 12:37:15 PM10/10/14
to phon...@googlegroups.com
PhoneGap Buid Fix for developers below. Needs PhoneGap team to create permanent fix:
I noticed that geolocation stopped working in my app on iOS 8. Below is a fix I submitted on another board that helped others and myself get geolocation working with PhoneGap Build 3.6.3, the new geolocation plugin (0.3.10) and iOS 8.0.2 (see below). I believe this needs to be addressed by the PhoneGap Build team: 

Apparently "NSLocationAlwaysUsageDescription" needs to be in the Info.plist file and after examining the results from PhoneGap Build and the new geolocation plugin ("0.3.10"), it is missing. iOS 8 changed the way permissions and geolocation work. So you need to add NSLocationAlwaysUsageDescription to the Info.plist file. To do this we had to add the following in our config.xml: 

<gap:config-file platform="ios" parent="NSLocationAlwaysUsageDescription" overwrite="false"></gap:config-file> 

This fixed the issue for many of us for geolocation (app never asking for permissions and therefore never getting GPS data). 

Can we have someone from the PhoneGap Build/Plugin team look into this? This is a very difficult problem to resolve for most developers and not something we had to address before. 

Thank you. 

David Norris 

On Wednesday, September 3, 2014 10:02:10 AM UTC-4, Karl Söderberg wrote:
Message has been deleted
Message has been deleted
Message has been deleted

Omer Sinai

unread,
Jan 4, 2015, 12:12:59 PM1/4/15
to phon...@googlegroups.com
Hi Shazron

I realize i'm a bit late, however i just found this: http://shazronatadobe.wordpress.com/2014/09/18/cordova-ios-and-ios-8/
Is it good? 

Regards,
Omer

Steve Husting

unread,
Jan 5, 2015, 10:56:02 AM1/5/15
to phon...@googlegroups.com
Uninstall the old plugin and install the new one.
PG was not designed for 5-year-olds :)

Omer Sinai

unread,
Jan 5, 2015, 11:52:59 AM1/5/15
to phon...@googlegroups.com
Ha Ha..

I uninstalled the plugin, and installed it again. 
I added the "NSLocationAlwaysUsageDescription" to the .plist (my app uses a geofencing in iOS so i guess i need this permission).
It still does not work, what an i missing? 

Sadashivudu Balabhadra

unread,
Jan 30, 2015, 6:14:32 AM1/30/15
to phon...@googlegroups.com
Hi Shazron, Good Evening.
My name is Sada, from India. I am working on Hybrid mobile app. We were using cordova 3.5 for build the mobile apps.
we are facing one strange issue with GeoLocation plugin. This is working fine in Ios7. In ios8 it is failing to find the geolocation.
I have created a sample project with cordova- 4.2.0 and geolocation plugin(0.3.11). again this is failing in IOS8. 
as per geolocation plugin release notes this issue was fixed in 0.3.10.
but we are still facing the same
Could you plz help me on this.? 
Thanks.
 Sada

Omer Sinai

unread,
Jan 30, 2015, 11:52:07 AM1/30/15
to phon...@googlegroups.com
Hi Sada, 

I'm facing the exact same issue with: navigator.geolocation.getCurrentPosition(success, fail, options);
I isolated the issue in order to get better focus on this bug.
Using Xcode 6.1.1  i created a cordova 3.5  simple app with a page that calls for  navigator.geolocation.getCurrentPosition
I'm working with the iOSSimulator on iOS 8 and it sometimes work and some time doesn't. 
I Go to Debug -> Location and i set "Apple" (at Cupertino)  and set Custom location with latLng custom input . As i said it works, then it doesn't. it's not stable.
It's very hard to determine. 

Regards,
Omer
Reply all
Reply to author
Forward
0 new messages