在vIEwDIDLoad中,最后启动单轨
self.beaconRegion.notifyOnEntry=YES;self.beaconRegion.notifyOnExit=YES;self.beaconRegion.notifyEntryStateOndisplay=YES;[self.locationManager startMonitoringForRegion:self.beaconRegion];
监控开始后,请为您定义的区域请求状态
- (voID) locationManager:(CLLocationManager *)manager dIDStartMonitoringForRegion:(CLRegion *)region{ [self.locationManager requestStateForRegion:self.beaconRegion];}
状态确定后,开始测距信标
-(voID)locationManager:(CLLocationManager *)manager dIDDetermineState:(CLRegionState)state forRegion:(CLRegion *)region{ if (state == CLRegionStateInsIDe) { //Start Ranging [manager startRangingBeaconsInRegion:self.beaconRegion]; } else { //Stop Ranging here }}
并根据您的需要实施以下方法…
- (voID)locationManager:(CLLocationManager *)manager dIDEnterRegion:(CLRegion *)region{ self.statusLbl.text=@"Entered region";}-(voID)locationManager:(CLLocationManager *)manager dIDExitRegion:(CLRegion *)region{ self.statusLbl.text=@"Exited region";}-(voID)locationManager:(CLLocationManager *)manager dIDRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region{ if(beacons.count>0) {}}
希望这将解决你的问题.
总结以上是内存溢出为你收集整理的ios – locationManager:当检测到信标时,didEnterRegion未被调用全部内容,希望文章能够帮你解决ios – locationManager:当检测到信标时,didEnterRegion未被调用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)