Introduction
For iOS apps, users can decide which application uses location service. Therefore you have to check location services enabled for your app. It's very easy.
Using the code
First, we have to check whether location services enabled for generally use. Second, we have to check whether location services enabled for our app.
Like this:
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."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
}
That's all!