iOS 8 Geo Location Permissions Not Appearing? Here's how to fix!

I was having issues with navigator.geolocation.getCurrentPosition() and iOS 8 never asking for permissions (and consequently failing.)

There are a few new permission types with iOS 8 and there are two things necessary for geolocation to function properly.

##First:##

Download:
CDVLocation.m at GitHub

And update (replace) this file found within your ionic project:
platforms/ios/*YourProjectHere*/Plugins/CDVLocation.m

##Second##

Update your .plist file found within your XCode project. In the Project Navigator, find the Resources directory and open the YourProjectHere-Info.plist by clicking it.

Add the following Key / Type / Values:

NSLocationAlwaysUsageDescription String Permissions Message for App even when not in use
NSLocationWhenInUseUsageDescription String Permissions Message for App when in use

You should now be able to compile and access geo location services in iOS 8!

This might very well not affect new projects but mine was not cooperating until I merged the updates.

7 Likes

Thank you, sir: you just saved me a ton of work!

Hi guys I badly need help, does this appear to you when your GPS is off?

Amazingly and unbelievable, but it works!!! Its funny, but when such stuff happens (you follow someoneā€™s guide you donā€™t understand) and it finally works I believe in myself more. Donā€™t know why.
Thanks!!!

Thank you! Thatā€™s honestly the nicest thing Iā€™ve ever received in my email. Thank you.

1 Like

Have you tried using this with the $ngCordova? Iā€™m not sure if itā€™s just me, but I canā€™t get geolocation working after the first prompt for permissions.

How about for Phonegap Build? is this fix doable?

Just use add to Content-Security-Policy this: gap://ready file:

Full: