iOS信标区域监控要求启用蓝牙 [英] iOS beacon region monitoring require to enable bluetooth

查看:180
本文介绍了iOS信标区域监控要求启用蓝牙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个具有信标区域监视功能的应用程序。下面是监视信标区域的代码。

I am developing an app which has beacon region monitoring.Below is the code for monitoring beacon region.

-(void)setBeaconMonitoringForUUID:(NSString *)strID withMajor:(NSString *)strMajor withMinor:(NSString *)strMinor withIdentifier:(NSString *)strIdentifier {
    NSUUID *strUUID = [[NSUUID alloc] initWithUUIDString:strID];
    CLBeaconRegion *beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:strUUID major:[strMajor intValue] minor:[strMinor intValue] identifier:strIdentifier];
    [beaconRegion setNotifyEntryStateOnDisplay:YES];
    [beaconRegion setNotifyOnEntry:YES];
    [beaconRegion setNotifyOnExit:YES];
    [self.objLocationManager startMonitoringForRegion:beaconRegion];    
    [self.objLocationManager startRangingBeaconsInRegion:beaconRegion];}

和locationManager初始化如下

and the locationManager initialization is as below

- (id)init
{
   self = [super init];
   if (self != nil)
   {
      self.objLocationManager = [CLLocationManager new];
      self.objLocationManager.delegate = self;
      self.objLocationManager.distanceFilter = 10.0;
      self.objLocationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
      self.objLocationManager.allowsBackgroundLocationUpdates = YES;

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

  }
  return self;
}

现在的问题是监视信标区域,iOS设备必须启用蓝牙还是不打开蓝牙就可以工作?。我也参考了以下链接,但是没有关于启用蓝牙进行区域监视的说明
确定区域监视的可用性

Now the question is for monitoring beacon region the iOS device must have to enable bluetooth or its working without turn on bluetooth?.I have also refer the below link but there is no explanation about to enable bluetooth for region monitoring Determining the Availability of Region Monitoring

我已经测试了使用kontakt.io信标,并且在不打开设备上的蓝牙的情况下无法工作,但是当我阅读区域监控正在使用位置服务时,为什么我们需要启用bluetooth.so,每个信标都需要打开蓝牙,或者它特定于kontakt。信标?

I have test with kontakt.io beacon and its not working without turning on bluetooth on device but as i read the region monitoring is working on Location service then why we need to enable bluetooth.so every beacon require to turn on bluetooth or it is specific to kontakt.io beacon?

推荐答案

Apple在iOS 11中进行了更改,以便即使用户在Control Center中禁用了蓝牙,也可以扫描和操作系统仍会检测iBeacon设备。 (控制中心是您从iOS屏幕底部向上滑动时获得的快速访问窗格。)请参见此处以了解更多详细信息: rel = nofollow noreferrer> https://support.apple.com/zh-cn/HT208086

Apple made a change in iOS 11 so that even if the user disables bluetooth in Control Center, scans for and detections of iBeacon devices are still performed by the operating system. (Control Center is the quick access pane you get by swiping up from the bottom of the screen on iOS.) See here for more details: https://support.apple.com/en-us/HT208086

以上声明不适用于iOS 10 .x及更早版本,在Control Center中关闭蓝牙将禁用信标检测。正如@ Paulw11在他的回答中指出的那样,您还必须在手机上启用位置信息,并且该应用程序必须先从该应用程序获取动态位置许可,然后才能检测到信标。

The above statement is not true for iOS 10.x and earlier, where turning off bluetooth in Control Center will disable beacon detection. And as @Paulw11 states in his answer, you must also have location enabled on the phone, and the app must obtain a dynamic location permission from the app before it can detect beacons.

同样在所有版本的iOS上,如果转到设置->蓝牙并禁用蓝牙,则会禁用信标检测。

Also on all versions of iOS, if you go to Settings -> Bluetooth and disable bluetooth it will disable beacon detection.

这篇关于iOS信标区域监控要求启用蓝牙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆