AirLocate 和 BeaconDemo:未显示

AirLocate and BeaconDemo : not showing up

我有 2 台设备,iPhone 5(作为信标)和 iPhone 5s(作为信标检测器),都带有 iOS 8.1。

两个设备都启用:

在iPhone5中,我安装了Apple的AirLocatedemo,配置如下(在配置页面):

由于报告原始 AirLocate 在 iOS 8 默认情况下不工作,我修改了 AppDelegate 的 didFinishLaunchingWithOptions 为:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    // This location manager will be used to notify the user of region state transitions.
    self.locationManager = [[CLLocationManager alloc] init];
    self.locationManager.delegate = self;
    if([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
        [self.locationManager requestAlwaysAuthorization];
    }

    if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
        [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
    }
    return YES;
}

在 iPhone 5 秒内,我安装了 Beacon Demo 并配置如下(添加一个新的 Beacon):

然而iPhone5在iPhone5秒后没有出现,一直声称"Not In Range"。我错过了什么?


截图:

左:AirLocate;右:信标演示


更新 Beacon 演示中的最新didFinishLaunchingWithOptions:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Set up Core Location Manager
    self.coreLocation = [[CLLocationManager alloc] init];
    _coreLocation.delegate = self;
    if([self.coreLocation respondsToSelector:@selector(requestAlwaysAuthorization)]) {
        NSLog(@"Core Location requesting always authorization");
        [self.coreLocation requestAlwaysAuthorization];
    }
    if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
        [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
    }

    // Load any previously registered notifications
    [self loadNotificationRegions];

    // Override point for customization after application launch.
    return YES;
}

如果您使用的是 here 的 Beacon Demo 版本,那么您需要对其进行与对 AirLocate 演示应用程序所做的相同的修改。这两个应用程序都没有请求 iOS 8.

中添加的必要权限

执行此操作时,请确保您还按照 here.

所述在 Info.plist 文件中添加了相应的条目