在我的app委托中,我正在注册接收didEnterRegion和didExitRegion的更新。具体来说,在didFinishLaunchingWithOptions
我声明并注册到信标,如下:
//Setup the beacon monitoring
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate=self;
for(CLRegion *r in locationManager.monitoredRegions){
[locationManager stopMonitoringForRegion:r];
}
self.beaconManager = [[ESTBeaconManager alloc] init];
self.beaconManager.delegate = self;
[self.beaconManager requestAlwaysAuthorization];
//Build the beacons
self.beaconRegion_1=[[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:target_UUID_1]
major:target_Major_1
minor:target_Minor_1
identifier:@"BridgeRegion_1"];
self.beaconRegion_2=[[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:target_UUID_2]
major:target_Major_2
minor:target_Minor_2
identifier:@"BridgeRegion_2"];
self.beaconRegion_3=[[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:target_UUID_3]
major:target_Major_3
minor:target_Minor_3
identifier:@"BridgeRegion_3"];
self.beaconRegion_4=[[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:@"73F2C305-CE97-410E-B0DF-11D5B4021A2E"]
major:1641
minor:55555
identifier:@"BridgeRegion_4"];
//Start the monitoring
self.beaconRegion_1.notifyOnEntry = YES;
self.beaconRegion_1.notifyOnExit = YES;
self.beaconRegion_1.notifyEntryStateOnDisplay = YES;
self.beaconRegion_2.notifyOnEntry = YES;
self.beaconRegion_2.notifyOnExit = YES;
self.beaconRegion_2.notifyEntryStateOnDisplay = YES;
self.beaconRegion_3.notifyOnEntry = YES;
self.beaconRegion_3.notifyOnExit = YES;
self.beaconRegion_3.notifyEntryStateOnDisplay = YES;
/*self.beaconRegion_4.notifyOnEntry = YES;
self.beaconRegion_4.notifyOnExit = YES;
self.beaconRegion_4.notifyEntryStateOnDisplay = YES;*/
[self.beaconManager startMonitoringForRegion:self.beaconRegion_1];
[self.beaconManager startMonitoringForRegion:self.beaconRegion_2];
[self.beaconManager startMonitoringForRegion:self.beaconRegion_3];
我遇到的问题是这样的,曾经信标startMonitoringForRegion
第三次调用它,永远不会触发任何didEnterRegion或didExitRegion调用。我已经交换了调用的顺序,无论哪个物理信标被称为第三个,这个规则都是常量。
我已经为ESTBeaconManager实现了所有委托函数,并且没有任何异常触发。任何帮助都会非常感激。
答案 0 :(得分:0)
基本上问题是对特定设备配置的限制,我在干净的设备(iPod 5-Gen)上测试了相同的代码并且它表现完美。为了记录,有问题的设备是运行iOS8.3(12f70)的iPhone 4s。
不确定这种经历将来会对任何人有所帮助,但我希望如此。