0

我没有收到信标区域的区域进入和退出事件。这就是我将信标添加到受监控区域的方式:

NSUUID *uuid = [[NSUUID alloc] initWithUUIDString: beacon.UUID];
CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:      uuid major: (CLBeaconMajorValue) beacon.major  minor: (CLBeaconMajorValue) beacon.minor  identifier:  @"SOME IDENTIFIER"];

[_locationManager startMonitoringForRegion: region];

和事件:

- (void) locationManager: (CLLocationManager *) manager didEnterRegion:   (CLRegion *) region
{
    NSLog(@"entered  beacon region");
}

- (void) locationManager: (CLLocationManager *) manager didExitRegion: (CLRegion *) region
{
    NSLog(@"exited beacon region");
}

此信标区域不会调用这些委托事件。

我已经在地理区域进行了测试,它可以工作,但它不适用于我的信标。此外,我已经在同一个信标上测试了测距,该信标有效。

信标监控是否存在任何已知问题?

非常感谢

4

1 回答 1

1

嗨@ldsarria 检查我的步骤它对我有用

第 1 步:在 .h 文件 CLLocationManagerDelegate 中设置 delgate

第2步:

locationManager = [[CLLocationManager alloc] init];
        locationManager.delegate = self;
        locationManager.desiredAccuracy = kCLLocationAccuracyBest;
        locationManager.distanceFilter = kCLDistanceFilterNone;

第 3 步:

NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"SOME IDENTIFIER"];
        CLBeaconRegion *region = [[CLBeaconRegion alloc] 
        initWithProximityUUID:uuid identifier:@"com.test.abc"];
                region.notifyEntryStateOnDisplay =YES;
                [locationManager startMonitoringForRegion:region];

第 4 步: 设置 NSLocationAlwaysUsageDescription = "此应用需要您的位置来寻找宝藏。"

干杯!!!

于 2015-04-15T11:22:47.783 回答