【问题标题】:Minimum radius for iOS CLRegion feature of LocatinManagerLocatinManager 的 iOS CLRegion 功能的最小半径
【发布时间】:2013-07-22 14:37:06
【问题描述】:

我目前正在使用位置管理器的区域功能。 不幸的是,我无法收到任何小于 100m 的过境点的通知。 我创建了半径为 20m / 50m 或 70m 的区域,但我总是只会在越过 100m 边界时收到通知。 但我想有一个更精细的半径 - 例如20m 并收到通知。如果我有一个大于 100m 的范围,一切都很好 - 例如 150米。在这种情况下,我一进入 150m 就会收到通知。

我尝试使用 LocationManager 上的“kCLLocationAccuracy”设置和 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];
}

有人知道如何在更近的边界上接收通知吗?任何帮助都将受到高度评价。

谢谢 火腿

【问题讨论】:

    标签: ios objective-c locationmanager clregion


    【解决方案1】:

    这种大小的区域是不可能的。位置事件主要由设备周围的 Wifi 触发。除非绝对必要,否则不会真正使用 GPS。所以50M以下的区域真的是垃圾拍摄。我已经与 CoreLocation 工程师讨论过这个问题(以及围绕区域监控的一些其他奇怪行为),并且由于对 Wifi 的依赖,不建议使用小尺寸。他们实际上推荐 150M,即使没有记录。

    如果您确实需要精细的位置更新,您可能需要实施自己的检查或启动 GPS 以获得非常准确的读数。这伴随着电池击中,因此您的里程可能会有所不同。祝你好运。

    【讨论】:

    • 150m的推荐是否适用于iOS 5-7?
    • 是的。我通常推荐 100M 以获得最佳效果,但 100-150 之间的任何值都可以。
    • 谢谢,我做一些测试。
    • 我知道这个问题已经很久了,但是在地理围栏中,我选择了 100 米半径,并且会出现“退出时”通知。但我在 250 米左右收到通知。请帮帮我。
    猜你喜欢
    • 2014-04-09
    • 2014-01-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多