我的任务是-找出设备上是否有可用的GPS模块。我使用CLLocationManager locationServicesEnabled来做这件事。但是,问题是-这是正常的吗,在模拟器上我有“真”?我认为它应该是"false“。有人能给我解释一下这个方法是怎么工作的吗?对于我的任务,这是正确的方法吗?
发布于 2011-08-19 06:13:44
检查gps是否启用的正确方法是使用下面的if语句:
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
}https://stackoverflow.com/questions/7040903
复制相似问题