2
我遇到了很奇怪的情況,同時與CLLocaitonManager玩....CLLocationManager didEnterRegion錯誤通知
manager = [[CLLocationManager alloc] init];
[manager setDistanceFilter:kCLDistanceFilterNone];
[manager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters];
manager.delegate = self;
我使用的區域與具有10.0米半徑區域的跟蹤......
[manager startMonitoringForRegion:region];
我定義的區域彼此非常接近,但絕對不會比50-100米更近...當我在iOS(5.0)模擬器中測試我的應用程序時(通過將位置設置爲Apple然後返回到我的自定義位置),我得到幾個同時發佈的通知,對於接近的地區對方......我也檢查
-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
CLLocation *regionLocation = [[CLLocation alloc] initWithLatitude:region.center.latitude longitude:region.center.longitude];
NSLog(@"didEnterRegion: %@ %f", region.identifier, [regionLocation distanceFromLocation:mapView.userLocation.location]);
[self notifyUserDidEnterRegion:region];
}
問題檢測區域的位置與我目前的位置之間的距離...是我得到通知其例如從我的當前位置距離酒店200米的區域...我幾乎在同一時間收到幾個通知...
有什麼建議嗎?或者我應該提供更多細節?
好吧......我不明白,這東西我是在某些情況下棘手的...但我還是不明白,爲什麼我在同一時間,當應用程序已經得到通知的三個地方我知道我距離一個5米...距離另一個100米...和距離最後一個200米...從邏輯上講,這只是沒有意義... – 2012-02-07 10:13:21
我知道你對此感到失望,我這也是我第一次發現這一點。原因可能是因爲你的地方離他們約400米。如果您的精確度是200米或更多(並且在位置監控中),則該範圍內的所有內容都將被觸發。我的意思是,當你開始區域監測時,你給出的準確性將被覆蓋。 – Andrea 2012-02-10 13:38:31