locationManager:didRangeBeacons方法未检测到BLE设备

Cas*_*eyG 2 iphone bluetooth ios ibeacon

我正在使用Nordic BLE nRF8001开发套件来测试CoreBluetooth.使用CBCentralManager的方法(例如didDiscoverPeripheral(),didConnectPeripheral()等),我的iPhone 5能够检测到北欧设备的广告并连接到它就好了.但是,我没有收到新的locationManager range或regionMonitoring方法的任何响应.下面我将解释我的设置:

1.)首先,我使用传入的外围设备(我的Nordic设备)在didDiscoverPeripheral()委托方法中从我的Nordic设备检索我的NSUUID.我为我的Nordic设备创建了一个自定义服务,所以假设这个外围设备是Nordic设备.要检索我使用的NSUUID:

    NSUUID *uuid = [peripheral identifier];  
    NSString *uuidString = [uuid UUIDString]; //uuidString = 9A8D4C73-152D-BBDA-E4C2-9CE952654645
Run Code Online (Sandbox Code Playgroud)

2.)接下来,我为我的Nordic设备创建一个信标区域并创建一个CLLocationManager:

    self.locationManagerBeacon = [[CLLocationManager alloc] init];
    [self.locationManagerBeacon setDelegate:self];
    NSUUID *myUUID = [[NSUUID alloc] initWithUUIDString:@"9A8D4C73-152D-BBDA-E4C2-9CE952654645"];
    self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:myUUID
                                                      identifier:@"nordicRegion"];
    self.beaconRegion.notifyEntryStateOnDisplay = YES;
Run Code Online (Sandbox Code Playgroud)

3.)现在我开始监控信标区域

[self.locationManagerBeacon startRangingBeaconsInRegion:self.beaconRegion];
Run Code Online (Sandbox Code Playgroud)

4.)问题:locationManager:didRangeBeacons:调用inRegion,但信标区域始终为空.

问题:Nordic BLE设备是否需要以某种方式配置,以便新的locationManager信标方法能够检测到它(例如BLE广告频率,功率电平等)?如果是这样,有人可以指向我的文档.

感谢帮助!

Dun*_*n C 6

我一直认为,为了使用信标测距,你必须先启动信标监控:

[theLocManager startMonitoringForRegion: region1];
[theLocManager startRangingBeaconsInRegion: region1];
Run Code Online (Sandbox Code Playgroud)

该代码对我来说效果很好(另外,和你一样,我也设置了notifyEntryStateOnDisplay = YES).

试试看,看看它是否有所作为.如果做不到这一点,我会说你在广播的BLE数据包中有什么问题,作为灯塔广告.

您也可以尝试下载Apple的AirLocate演示(它将同时监听信标并将您的iOS设备转换为信标.)您可以使用AirLocate查看它是否将您的自定义BLE设备识别为信标.如果是,则使用AirLocate作为信标进行传输,并查看您的代码是否识别它.