Ibeacon和推荐的应用程序

时间:2015-04-20 15:46:21

标签: ios ibeacon lockscreen

如果可以使用IBeacons

使用“推荐应用”功能,我需要这样做

这是我的代码:

self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid major:1 minor:1 identifier:@“EstimoteSampleRegion”];

self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;

[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
[self.locationManager requestAlwaysAuthorization];
[self.locationManager startUpdatingLocation];

调用背景方法,就像didRangeBeacons一样,但我的锁屏是空的。

谢谢!

1 个答案:

答案 0 :(得分:3)

对于推荐的应用功能,您需要使用startMonitoringForRegion而不是startRangingBeaconsInRegion

此外,您似乎正在后台进行测距([self.locationManager startUpdatingLocation]; +我认为已启用的位置服务背景模式),您不需要为推荐的应用功能提供此功能。它会耗尽手机的电量(因为它会使应用程序保持清醒状态),Apple通常会拒绝那些没有充分理由的应用程序(例如,增强了对信标支持的导航应用程序)。