0
我正在从硬件iBeacon获取数据,我可以在其中编程以更改其UUID。iBeacon标识符值 - 为什么它不起作用?
我知道硬件的UUID
,但我不明白什么是标识符:
[[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"com.name.iBeacon"];
它是我的应用程序标识符,或东西iBeacon显示正在发送(它的名字吗?) 不知这就是为什么它不起作用。 我已经设置好一切,我甚至不能发现iBeacon显示:
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"74278BDA-B644-4520-8F0C-720EAF059935"];
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"com.company.iBeacon"];
[self.locationManager startMonitoringForRegion:self.beaconRegion];
[self locationManager:self.locationManager didStartMonitoringForRegion:self.beaconRegion];
比这些代表,这是在同一个班(?应该是在应用程序委托)从未被触发:
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
NSLog(@"ENTER");
}
-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region {
[self.locationManager stopRangingBeaconsInRegion:self.beaconRegion];
NSLog(@"EXIT");
}
我读过,你必须进出该区域?
另一个问题是,苹果公司表示,每个BLE都有服务,包括特性,但是在iBeacon中,主要和次要的价值是什么?同一项服务的特点?
标识符是您想要的任何字符串。您可以使用它来区分委托方法中的不同信标区域。至于为什么你的代表没有被调用,如果你正在运行ios8,你需要在使用时请求或始终授权位置管理器 – Paulw11 2014-11-23 12:49:35
主要和次要值只是进一步识别您的区域的方法。主要可能是地板,未成年人可能表示该部门 - 这取决于你。 iBeacon与BLE设备不同 - 它不会广告任何服务或特性 – Paulw11 2014-11-23 12:51:26
顺便说一句,您错了,iBeacon会广告服务和特性,如果您将编写BLE代码,您会发现它以及它的服务。服务和特性是协议的一部分BLE – Curnelious 2014-11-23 13:17:55