First question is better is Estimote SDK or CoreLocation framework? I have app which is finding the beacons but now i must made an app which will find beacons when application is in background or even is terminated.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Setting up background detection is pretty automatic in iOS so long as you do it in your AppDelegate and receive callbacks in that class:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;
CLBeaconRegion *region;
region = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:@"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6"] major: 1 minor: 1 identifier: @"region1"];
region.notifyEntryStateOnDisplay = YES;
[_locationManager startMonitoringForRegion:region];
[_locationManager startRangingBeaconsInRegion:region];
return YES;
}
You can read more about what you can expect from detection times in the background here:
http://developer.radiusnetworks.com/2013/11/13/ibeacon-monitoring-in-the-background-and-foreground.html