Monday 6 November 2017

objective c - Location Services not working in iOS 8

itemprop="text">

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?


class="post-text" itemprop="text">
class="normal">Answer



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.



href="https://i.stack.imgur.com/iuOzB.jpg"> src="https://i.stack.imgur.com/iuOzB.jpg" alt="enter image description
here">



Hope it helps someone
else.



EDIT: For more extensive information, have
a look at: href="http://nevan.net/2014/09/core-location-manager-changes-in-ios-8/">Core-Location-Manager-Changes-in-ios-8



No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...