我将遵循以下教程:
http://www.appcoda.com/ios7-programming-ibeacons-tutorial/
然而,我没有使用iPhone作为信标,但我使用的是来自制造商(RECO,Estimote)的真实信标。
我不知道下面一行中的标识符字段该使用什么:
// Setup a new region with that UUID and same identifier as the broadcasting //beacon
self.myBeaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"what should I use here?"];我可以修改信标的UUID、主要和次要值,但没有用于修改标识符的选项。标识符是什么?
发布于 2015-05-12 22:21:40
该字符串标识符只是一个惟一的关键字,您可以使用它来标识区域。您可以在字符串中输入您想要的的任何值,只要当您想要替换正在被范围/监视的区域,或在该区域上停止范围/监视时,使用相同的值来再次标识区域。
以下示例将开始监控两个地域(基于两个不同的UUID,具有两个不同的标识符"first_region“和"second_region":
[_locationManager startMonitoringForRegion:
[[CLBeaconRegion alloc] initWithProximityUUID:first_uuid
identifier:@"first_region"]];
[_locationManager startMonitoringForRegion:
[[CLBeaconRegion alloc] initWithProximityUUID:second_uuid
identifier:@"second_region"]];然后,您可以使用如下代码停止对第二个区域的监控:
[_locationManager startMonitoringForRegion:
[[CLBeaconRegion alloc] initWithProximityUUID:second_uuid
identifier:@"second_region"]];在上面的代码行中重要的是这个"second_region“标识符字符串。要正确停止监视,它必须与您用来开始监视区域的字符串匹配。
发布于 2015-05-12 22:42:05
如果您只使用一个区域,那么您可以为它提供任何字符串值,如下所示;有关更多信息,请参阅这篇文章的https://stackoverflow.com/a/20566695/1351327
static NSString * const kIdentifier = @"SomeIdentifier";
static NSString * const kUUID = @"124C5678-4444-1111-2222-134556728422";
// Then create the region
NSUUID *proximityUUID = [[NSUUID alloc] initWithUUIDString:kUUID];
CLBeaconRegion *beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:proximityUUID identifier:kIdentifier];https://stackoverflow.com/questions/30192536
复制相似问题