当显示为关闭时,不会调用didRangeBeacons方法

Mad*_*dhu 3 background ios uilocalnotification ios7 ibeacon

我在几周内与ibeacons合作,当iphone击中beaconregion(靠近附近时)时,我试图发布一些本地通知.

当应用程序在后台锁定并显示时,它工作正常,但当我的显示变黑时,didRangeBeacons方法停止被调用.

我知道通过使用

 region.notifyEntryStateOnDisplay = true;
Run Code Online (Sandbox Code Playgroud)

我们可以在显示时收到通知.

有什么方法可以实现发布通知,而应用程序是后台锁定和显示关闭.

请帮帮我.

Joh*_*Doe 11

在背景中完全可以放置信标.

您可以通过与当前位置管理器一起设置或创建并行管理器来解决限制(我认为这没有区别).您还需要在项目中启用后台位置更新功能.

locationManager2 = [[CLLocationManager alloc] init];
locationManager2.delegate = self;
locationManager2.desiredAccuracy = kCLLocationAccuracyKilometer;
[locationManager2 startUpdatingLocation];

-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
     //Do nothing here, but enjoy ranging callbacks in background :-)
}
Run Code Online (Sandbox Code Playgroud)

现在,当Apple问您为什么需要在您的应用中使用后台位置更新模式时,您需要有一个很好的解释.他们非常挑剔.