我目前正在工作的地区功能的位置管理器。不幸的是,我无法收到任何小于100m的边境口岸的通知。我创建了半径为20m / 50m或70m的区域,当我越过100m边界时,我总是只收到通知。但我希望有一个更好的半径--例如20米,并为此收到通知。如果我有一个大于100m的距离--例如150m,那么一切都工作得很好。在这种情况下,我一进入150m就会收到一条通知。
我尝试在LocationManager上使用"kCLLocationAccuracy"-settings和创建CLRegions,但似乎都没有任何效果。
这是我使用的代码:
- (void) initializeLocationManager
{
// Check to ensure location services are enabled
if(![CLLocationManager locationServicesEnabled]) {
[self showAlertWithMessage:@"You need to enable location services to use this app."];
return;
}
if(![CLLocationManager regionMonitoringAvailable]) {
[self showAlertWithMessage:@"This app requires region monitoring features which are unavailable on this device."];
return;
}
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
self.locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
}
- (void) setupGeoFence:(Station*)station
{
CLLocationCoordinate2D centerCoordinate = CLLocationCoordinate2DMake([station.gpsPosition.latitude doubleValue], [station.gpsPosition.longitude doubleValue]);
CLRegion *geofence = [[CLRegion alloc] initCircularRegionWithCenter:centerCoordinate radius:[range doubleValue] identifier:station.name];
[self.locationManager startMonitoringForRegion:geofence desiredAccuracy:kCLLocationAccuracyBest];
}有人知道如何在更近的边界上接收通知吗?任何帮助都会得到高度评价。
谢谢Hamtho
发布于 2013-07-23 02:20:10
那么大的区域是不可能的。定位事件主要由设备周围的Wifi触发。除非绝对必要,否则不会真正使用GPS。因此,50M以下的区域真的是一个垃圾拍摄。我已经和CoreLocation的工程师谈过这一点(以及其他一些围绕区域监控的奇怪行为),由于对Wifi的依赖,不推荐这么小的尺寸。他们实际上推荐1.5亿,即使没有文档记录。
如果你真的需要细粒度的位置更新,你可能需要实现自己的检查或启动GPS来获得非常准确的读数。这是伴随着电池消耗而来的,所以你的里程可能会有所不同。祝好运。
https://stackoverflow.com/questions/17790350
复制相似问题