如何不断检查GPS信号强度

时间:2013-07-17 12:22:17

标签: iphone ios objective-c ios6 core-location

我想以图像的形式显示GPS信号强度,如:
enter image description here
但我找不到任何关于这个或例子的文件 我试过这个:

if (self.locationManager.location.horizontalAccuracy < 0)
        {
            ...@"No"];
        }
        else if (self.locationManager.location.horizontalAccuracy > 163)
        {
            ...@"Poor"];
        }
        else if (self.locationManager.location.horizontalAccuracy > 48)
        {
            ...@"Average"];
        }
        else
        {
            ...Full
        }

但是这个代码什么也没做 如何监控GPS信号强度,是否可能?

1 个答案:

答案 0 :(得分:2)

此代码位于何处?您的代码应该在委托回调中:

- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
       fromLocation:(CLLocation *)oldLocation

或iOS 6.0及以上版本:

- (void)locationManager:(CLLocationManager *)manager
 didUpdateLocations:(NSArray *)locations