在背景Objective-C中扫描Kontakt.io iBeacons

在背景Objective-C中扫描Kontakt.io iBeacons,objective-c,ibeacon,Objective C,Ibeacon,我试图找到如何在后台扫描iBeacons,但据我所知,您只能在用户进入某个区域时进行检查,我尝试启用后台模式,然后我记录了应在后台工作的两种方法: - (void)locationManager:(KTKLocationManager *)locationManager didEnterRegion:(KTKRegion *)region { NSLog(@"Enter region %@", region.uuid); } - (void)lo

我试图找到如何在后台扫描iBeacons,但据我所知,您只能在用户进入某个区域时进行检查,我尝试启用后台模式,然后我记录了应在后台工作的两种方法:

    - (void)locationManager:(KTKLocationManager *)locationManager didEnterRegion:(KTKRegion *)region
    {
        NSLog(@"Enter region %@", region.uuid);
    }

    - (void)locationManager:(KTKLocationManager *)locationManager didExitRegion:(KTKRegion *)region
    {
        NSLog(@"Exit region %@", region.uuid);
    }

但是这些设备在后台似乎没有扫描,我缺少了什么?

使用Kontakt.io SDK实现起来非常简单:) 只需查看此链接。 我相信你没有把这个加到你的名单上。 在允许通过应用程序访问您的位置后,将其添加到应用程序中,方法:

- (void)locationManager:(KTKLocationManager *)locationManager didEnterRegion:(KTKRegion *)region;
- (void)locationManager:(KTKLocationManager *)locationManager didExitRegion:(KTKRegion *)region
将被调用,如果您收到didEnterRegion,则会自动调用(几次)方法:


当然,如何延长背景时间等是另一个话题;)

问题中的方法是监视回调。尝试使用测距回调并开始测距。请给出一个您将使用的代码示例,好吗?对不起,我不是Kontakt IO wrapper SDK的专家。如果您使用的是iOS内置的CoreLocation API,则使用以下回调:
-(void)locationManager:(CLLocationManager*)manager didRangeBeacons:(NSArray*)区域内的信标:(CLBeaconRegion*)区域{}
- (void)locationManager:(KTKLocationManager *)locationManager didRangeBeacons:(NSArray *)beacons;