My app that worked fine on iOS 7 doesn't work with the iOS 8 SDK.
CLLocationManager
doesn't return a location, and I don't see my app under Settings -> Location Services either. I did a Google search on the issue, but nothing came up. What could be wrong?
Enable Location Services In general, the most common reason for “Share My Location” feature not working on iPhone is due to Location Services being disabled. Go to Settings > Privacy > tap on Location Services. On the Location services screen, make sure that the option for Location Services is turned ON.
If you can't find your current location on your iPhone, iPad, or iPod touch. Turn on Location Services and Location Access for Maps. In the Settings app, tap Privacy, then tap Location Services. Make sure Location Services is on, and make sure Maps is set to While Using the App or Widgets.
Step 1: Open the Settings app on your phone and scroll down to tap on Location. Step 2: Go to Location services and tap on Google Location Accuracy. Step 3: Toggle on Improve Location Accuracy. Once enabled, check to see if location accuracy has improved by using an app like Google Maps.
I ended up solving my own problem.
Apparently in iOS 8 SDK, requestAlwaysAuthorization
(for background location) or requestWhenInUseAuthorization
(location only when foreground) call on CLLocationManager
is needed before starting location updates.
There also needs to be NSLocationAlwaysUsageDescription
or NSLocationWhenInUseUsageDescription
key in Info.plist
with a message to be displayed in the prompt. Adding these solved my problem.
For more extensive information, have a look at: Core-Location-Manager-Changes-in-ios-8
I was pulling my hair out with the same problem. Xcode gives you the error:
Trying to start
MapKit
location updates without prompting for location authorization. Must call-[CLLocationManager requestWhenInUseAuthorization]
or-[CLLocationManager requestAlwaysAuthorization]
first.
But even if you implement one of the above methods, it won't prompt the user unless there is an entry in the info.plist for NSLocationAlwaysUsageDescription
or NSLocationWhenInUseUsageDescription
.
Add the following lines to your info.plist where the string values represent the reason you you need to access the users location
<key>NSLocationWhenInUseUsageDescription</key> <string>This application requires location services to work</string> <key>NSLocationAlwaysUsageDescription</key> <string>This application requires location services to work</string>
I think these entries may have been missing since I started this project in Xcode 5. I'm guessing Xcode 6 might add default entries for these keys but have not confirmed.
You can find more information on these two Settings here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With