1

如何知道 iphone 中重要位置更新的准确度?作为标准位置,可以根据可以设置的参数来设置精度等级,但是不能为精度设置显着的位置精度,但是如何读取接收到的位置更新的精度呢?

4

1 回答 1

1

该类CLLocationManager有一个精度参数,称为desiredAccuracy哪个是类的CLLocationAccuracy。但是坚持住!它不是一个类,它是一个typedef double所以这里是常量

extern const CLLocationAccuracy kCLLocationAccuracyBestForNavigation __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
extern const CLLocationAccuracy kCLLocationAccuracyBest;
extern const CLLocationAccuracy kCLLocationAccuracyNearestTenMeters;
extern const CLLocationAccuracy kCLLocationAccuracyHundredMeters;
extern const CLLocationAccuracy kCLLocationAccuracyKilometer;
extern const CLLocationAccuracy kCLLocationAccuracyThreeKilometers;

我建议您做的是将您的位置管理器的准确性分配给一个新变量,然后将其进行比较,如下所示:

CLLocationAccuracy locationAccuracy = self.locationManager.desiredAccuracy;

if (locationAccuracy == kCLLocationAccuracyBest) {

    NSLog(@"It is the kCLLocationAccuracyBest my life is complete!");
}
else if (/*other comparisons stuff here*/) {

}

此外,您必须导入:

#import <CoreLocation/CLLocation.h>

罗汉

于 2013-01-06T06:28:16.593 回答