Ios: App Is Not Asking User's Permission While Installing the App. Getting Kclauthorizationstatusnotdetermined Every Time - Objective-C & Swift

iOS: App is not asking user's permission while installing the app. getting kCLAuthorizationStatusNotDetermined every time - Objective-c & Swift

I was facing the same issue, after re-installing my app it was returning kCLAuthorizationStatusNotDetermined whenever checking for [CLLocationManager authorizationStatus] and the app didn't even show up in Settings > Privacy > Location Services.

The authorization dialog that iOS prompts user to approve access to location services is triggered on [locationManager startUpdatingLocation] which in your case is never called (shouldFetchUserLocation will be always NO).

Miguel C.'s solution seems like a good fix, will try that.

Edit for iOS8.x

When iOS8 came it brought little change in the way CLLocationManager is used. As mentioned few times in other answers it requires additional step comparing to iOS7. Today I faced the issue myself and found this article (it's been referenced from multiple other questions but it completes my earlier answer). Hope it helps!

Unable to get the permission prompt from CLLocationManager

Your CLLocationManager object is local object and thus will be deallocated immediately after it falls out of scope. Make it a class property and then asynchronous processes like requesting authorization and determining the location will have a chance to run.

Location access - App is not asking for user permission to access location - iOS 11

I have gone through the Apple documentation and found the solution for this question.

Apple has changed few guidelines to get user location.

Here is the Video Link: Apple- What's New in Location Technologies

Full code for location access in Swift & Objective-C both

Solution:

Now we need to add three Authentication Key into Plist:

  1. NSLocationAlwaysAndWhenInUseUsageDescription
  2. NSLocationWhenInUseUsageDescription
  3. NSLocationAlwaysUsageDescription

Plist will look like :
iOS Sample Image 50
And Authentication message screen will look like:

Sample Image

Full code for location access

My CoreLocation based Swift app is not asking user's permission to access location

Move LocationManager.requestAlwaysAuthorization() to the viewDidAppear method.

EDIT:

Ok, you are asking requestAlwaysAuthorization but in info.plist you set the When in usage... key entry, so change the requestAlwaysAuthorization to the requestWhenInUseAuthorization

Location Services not working in iOS 8

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.

Sample Image

For more extensive information, have a look at: Core-Location-Manager-Changes-in-ios-8

How to check location authorization status at the click of a button in iOS 14?

You're code works - but have you remembered to add the privacy usage descriptions to the info.plist file?

Add these two entries in the file with your own explanation in the value field, then it should popup in the simulator:

  • Privacy - Location Always and When In Use Usage Description
  • Privacy - Location When In Use Usage Description


Related Topics



Leave a reply



Submit