Melih Mucuk Melih Mucuk - 7 months ago 57
Objective-C Question

Checking location service permission on iOS

How can I check if location service is enabled for my app?

I have 2 storyboards and I want to check location service. If location service enabled for my app, I want to launch map storyboard with location. Otherwise, I want to launch another storyboard. How can I do programmatically?


This is the correct.

if([CLLocationManager locationServicesEnabled]){

           NSLog(@"Location Services Enabled");

           if([CLLocationManager authorizationStatus]==kCLAuthorizationStatusDenied){
                alert = [[UIAlertView alloc] initWithTitle:@"App Permission Denied" 
                                                        message:@"To re-enable, please go to Settings and turn on Location Service for this app." 
                [alert show];