小编Vat*_*l K的帖子

如何在不知道iOS中的UUID的情况下检测ibeacon设备?

我想在不知道uuid的情况下开发能够检测到许多信标设备的应用程序.但是我找不到办法做到这一点.我必须在代码中定义uuid.

我开发了一种可与已知设备配合使用的POC.

我的视图控制器代码:

-(void)setUpview
{
     // Regardless of whether the device is a transmitter or receiver, we need a beacon region.
    NSUUID * uid = [[NSUUID alloc] initWithUUIDString:@"78CDC73D-D678-4B35-A88A-C2E09E5B963F"];//[UIDevice currentDevice].identifierForVendor;
    treasureId = @"com.eden.treasure";
    self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uid identifier:treasureId];

    // Location manager.
    self.locationManager = [[CLLocationManager alloc] init];
    self.locationManager.delegate = self;

    if([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
        [self.locationManager requestAlwaysAuthorization];
    }

    [self.locationManager startMonitoringForRegion:self.beaconRegion];
    [self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
    [self locationManager:self.locationManager didStartMonitoringForRegion:self.beaconRegion];

    [self.beaconRegion setNotifyEntryStateOnDisplay:YES];
    [self.beaconRegion setNotifyOnEntry:YES];
    [self.beaconRegion setNotifyOnExit:YES];

//    self.peripheralManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:nil];
    if ([UIDevice currentDevice].userInterfaceIdiom==UIUserInterfaceIdiomPad || [[[UIDevice …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios core-bluetooth ibeacon

4
推荐指数
1
解决办法
4812
查看次数

标签 统计

core-bluetooth ×1

ibeacon ×1

ios ×1

iphone ×1

objective-c ×1