mysho
mysho

Reputation: 353

iPhone check location services

I have an app with location services. If I disable location services in preferences, I check this state with this method: [CLLocationManager locationServicesEnabled] This method return if are all location services enabled or disabled. But problem is that I don't know, how to check state of location service for my app. I mean state when are all location services enabled and disabled is only my app ? How can I check this ? [CLLocationManager locationServicesEnabled] not working here ... Thanks a lot ..

Upvotes: 0

Views: 426

Answers (2)

iArezki
iArezki

Reputation: 1271

I use this in my code, and it work fine

if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized ) 
{
    //do something
}
else 
{
    //display an alert for example
}

Upvotes: 1

Nuzhat Zari
Nuzhat Zari

Reputation: 3408

Returns the application’s authorization status for using location services.

+ (CLAuthorizationStatus)authorizationStatus

Return Value

A value indicating whether the application is authorized to use location services.

Upvotes: 1

Related Questions