0

第一个问题是 Estimote SDK 还是 CoreLocation 框架更好?我有一个正在寻找信标的应用程序,但现在我必须制作一个应用程序,它可以在应用程序处于后台甚至终止时找到信标。

4

1 回答 1

0

只要您在 AppDelegate 中进行设置并在该类中接收回调,在 iOS 中设置背景检测是非常自动的:

- (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;
}

您可以在此处阅读有关后台检测时间的更多信息:

http://developer.radiusnetworks.com/2013/11/13/ibeacon-monitoring-in-the-background-and-foreground.html

于 2014-11-21T19:39:57.070 回答