Contenu connexe
Similaire à I beaconについて (20)
I beaconについて
- 13. 6.Beaconを動かしてみた
3.viewDidLoadで測定開始
if ([CLLocationManager isMonitoringAvailableForClass:[CLBeaconRegion class]])
{
if( _locationManager == nil ) {
_locationManager = [CLLocationManager new];
_locationManager.delegate = self;
}
_proximityUUID = [[NSUUID alloc] initWithUUIDString:beaconUUID];
_beaconRegion = [[CLBeaconRegion alloc]
initWithProximityUUID:_proximityUUID identifier:@"EstimoteSampleRegion"];
[_locationManager startMonitoringForRegion:_beaconRegion];
// 最初から範囲内にいるとイベントが走らないのでここで走らせておく。
[_locationManager startRangingBeaconsInRegion:_beaconRegion];
}