的LocationManager:didRangeBeacons法未检测BLE设备 [英] locationManager:didRangeBeacons method not detecting BLE Device

查看:386
本文介绍了的LocationManager:didRangeBeacons法未检测BLE设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的测试CoreBluetooth北欧BLE nRF8001开发套件。使用CBCentralManager的方法(例如didDiscoverPeripheral(),didConnectPeripheral()等)的我的iPhone 5能够检测北欧设备的广告,并连接到它只是罚款。但是,我没有收到新的LocationManager范围或regionMonitoring方法任何回应。下面我来解释我的设置:

I'm using a Nordic BLE nRF8001 development kit for testing CoreBluetooth. Using CBCentralManager's methods(e.g. didDiscoverPeripheral(), didConnectPeripheral(), etc.) my iPhone 5 is able to detect the Nordic device's advertisements and connect to it just fine. However, I'm not receiving any response from the new locationManager ranging or regionMonitoring methods. Below I'll explain my setup:

1)。首先我使用的外围设备通过了(我的北欧设备取回我的NSUUID从我在didDiscoverPeripheral()的委托方法北欧设备)。我创建了一个自定义的服务,为我除其他事项外北欧设备,因此假设该外设是北欧的设备。要检索我用NSUUID:

1.) First I retrieved my NSUUID from my Nordic device in the didDiscoverPeripheral() delegate method using the passed in peripheral device (my Nordic device). I created a custom service for my Nordic device among other things, so assume this peripheral is the Nordic device. To retrieve the NSUUID I used:

    NSUUID *uuid = [peripheral identifier];  
    NSString *uuidString = [uuid UUIDString]; //uuidString = 9A8D4C73-152D-BBDA-E4C2-9CE952654645

2)接下来,我为我的北欧设备创建一个灯塔区域,并创建一个CLLocationManager:

2.) Next I create a beacon region for my Nordic device and create a 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;

3)。现在我开始监测为航标区

3.) Now I start monitoring for the beacon region

[self.locationManagerBeacon startRangingBeaconsInRegion:self.beaconRegion];

4)的问题:的LocationManager:didRangeBeacons:inRegion被调用,但标区总是空的。

4.) Problem: locationManager:didRangeBeacons:inRegion gets invoked, but the beacons region is always empty.

问题:
   确实北欧BLE设备需要以某种方式进行配置,使得新的LocationManager信标方法会检测到它(例如BLE广告频率,功率水平等)?如果是这样,可能有人指向我的文档。

Question: Does the Nordic BLE device need to be configured in a certain manner such that the new locationManager beacon methods will detect it (e.g. BLE advertisement frequency, power level, etc.)? If so, could someone point me to the documentation.

鸭preciate的帮助!

Appreciate the help!

推荐答案

我一直认为,以使用范围灯塔,你必须先启动航标监控:

I've always assumed that in order to use beacon ranging you have to first start beacon monitoring:

[theLocManager startMonitoringForRegion: region1];
[theLocManager startRangingBeaconsInRegion: region1];

这code工作得很好,我(加上你一样,我还设置notifyEntryStateOnDisplay = YES)。

That code works just fine for me (plus, like you, I also set notifyEntryStateOnDisplay = YES).

试一下,看看它是否有差别。做不到这一点,我说你有什么错在你广播作为一盏明灯广告的BLE包。

Try that and see if it makes a difference. Failing that, I'd say you have something wrong in the BLE packet you are broadcasting to serve as a beacon advertisement.

您也可以尝试下载苹果的AirLocate演示(这都将侦听信标,将您的iOS设备变成一盏明灯。)你可以使用AirLocate,看它是否承认你的自定义BLE装置的一盏明灯。如果确实如此,那么使用AirLocate发送信标,看看你的code识别。

You might also try downloading Apple's AirLocate demo (which will both listen for beacons and turn your iOS device into a beacon.) You could use AirLocate to see if it recognizes your custom BLE device as a beacon. If it does, then use AirLocate to transmit as a beacon and see if your code recognizes it.

这篇关于的LocationManager:didRangeBeacons法未检测BLE设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆