Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 984079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:57:26+00:00 2026-05-16T04:57:26+00:00

I have location services disabled for my application in the settings panel. I run

  • 0

I have location services disabled for my application in the settings panel. I run a test in viewDidLoad in my view controller to see if they are enabled:

if([CLLocationManager locationServicesEnabled]) {
   //Do something now
}

This test always passes for some reason. If I try and access location services I get a kCLErrorDenied error for the location manager. What gives?

Am I using the wrong test?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:57:27+00:00Added an answer on May 16, 2026 at 4:57 am

    The locationServicesEnabled class method only tests the global setting for Location Services. AFAIK, there’s no way to test if your app has explicitly been denied. You’ll have to wait for the location request to fail and use the CLLocationManagerDelegate method locationManager:didFailWithError: to do whatever you need. E.g.:

    - (void)locationManager: (CLLocationManager *)manager
           didFailWithError: (NSError *)error {
    
        NSString *errorString;
        [manager stopUpdatingLocation];
        NSLog(@"Error: %@",[error localizedDescription]);
        switch([error code]) {
            case kCLErrorDenied:
                //Access denied by user
                errorString = @"Access to Location Services denied by user";
                //Do something...
                break;
            case kCLErrorLocationUnknown:
                //Probably temporary...
                errorString = @"Location data unavailable";
                //Do something else...
                break;
            default:
                errorString = @"An unknown error has occurred";
                break;
            }
        }
    
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:errorString delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
        [alert show];
        [alert release];
    }
    

    See the documentation on the CLError constants in the CLLocationManager class reference for more options.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application web.xml with the following entry: <error-page> <error-code>404</error-code> <location>/system_files/error/p_notfound.jsp</location> </error-page> However,
I have given a location defined by latitude and longitude. Now i want to
I have this rewrite rule RewriteEngine On RewriteBase /location/ RewriteRule ^(.+)/?$ index.php?franchise=$1 Which is
We have a JavaScript function named move which does just windows.location.href = any given
I have a Powershell script that copies files from one location to another. Once
I have table with 50 entries (users with such details like Name Surname Location
I have 2 machines, one at Location A and the other at Location B.
I have a database table named call with columns call_time, location, emergency_type and there
I have the following in my web.config: <location path=RestrictedPage.aspx> <system.web> <authorization> <allow roles=Group1Admin, Group3Admin,
I have two tables: Table 1: ID, PersonCode, Name, Table 2: ID, Table1ID, Location,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.