【发布时间】:2015-02-09 08:15:32
【问题描述】:
如何通过 iBeacon Advertising Packet 添加数据(例如广播其名称)?
我目前的情况:我有 3 个发射器和 1 个接收器。但我无法区分它们,除非我一个一个打开或关闭发射器。
如何向接收者广播信息?以及如何检索这些数据?
接收方代码如下(在 App Delegate didFinishLaunchingWithOptions: 中):
NSUUID *beaconUUID = [[NSUUID alloc] initWithUUIDString:@"E2C56DB5-DFFB-48D2-B060-D0F5A71096E0"];
NSString *regionIdentifier = @"us.iBeaconModules";
CLBeaconRegion *beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:beaconUUID identifier:regionIdentifier];
self.locationManager = [[CLLocationManager alloc] init];
if([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
[self.locationManager requestAlwaysAuthorization];
}
self.locationManager.delegate = self;
self.locationManager.pausesLocationUpdatesAutomatically = NO;
[self.locationManager startMonitoringForRegion:beaconRegion];
[self.locationManager startRangingBeaconsInRegion:beaconRegion];
[self.locationManager startUpdatingLocation];
【问题讨论】:
标签: ios cllocationmanager ibeacon