My task is - to figure out, if there is GPS module available on the dev开发者_运维技巧ice. I'm using [CLLocationManager locationServicesEnabled] for this. But, question is - is this normal, that on simulator I have "true"? I think it should be "false". Can anybody explain me, how this method works? Is this correct method for my task?
the correct method of checking if ths gps is enabled or not is using this if statement :
if (! ([CLLocationManager locationServicesEnabled]) //chech for location of the device
|| ( [CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied))
//chech for the location of your current app
{
// the gps isn't enabled
} else {
// the gps is enabled
}
精彩评论