2013-07-17 40 views
0

我想在像圖像的形式顯示GPS信號強度:
enter image description here
但我不能找到有關這個或例子的任何文件。
我已經試過這樣:如何不斷地檢查GPS信號強度

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

但它接縫,該代碼什麼也不做。
如何監測GPS信號強度,可以嗎?

+0

有你放置在此在的LocationManager的委託方法之一,並設置委託呢? – soryngod

回答

2

此代碼位於何處?您的代碼應在委託回調:

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

或iOS 6.0及以上版本:

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

酷我把它放在(void)locationManager中...現在我總是得到數據。我希望這是監測GPS信號的好方法。謝謝。 – 1110

+0

這是[推薦](http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html#//apple_ref/doc/uid/TP40009497-CH2-SW1 )方法 – Alex

+0

那麼我寫的代碼不是?本文檔的哪部分講述了監控信號強度? – 1110