如何在iphone中获得重要位置更新的准确性?

时间:2013-01-06 06:17:52

标签: iphone objective-c location

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

1 个答案:

答案 0 :(得分: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>

罗汉