问题
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
来源:https://stackoverflow.com/questions/27061689/estimote-sdk-beacons-raging-in-background