AirLocate 和 BeaconDemo:未显示
AirLocate and BeaconDemo : not showing up
我有 2 台设备,iPhone 5(作为信标)和 iPhone 5s(作为信标检测器),都带有 iOS 8.1。
两个设备都启用:
- 定位服务(隐私 > 定位服务 > 始终用于 AirLocate)
- 蓝牙
- Wi-Fi,加入具有互联网连接的相同 SSID(不太相关)
- iPhone5s有SIM卡,信号足够
- iPhone5没有SIM卡
在iPhone5中,我安装了Apple的AirLocatedemo,配置如下(在配置页面):
- 启用:是
- UUID:E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
- 专业:0
- 未成年人:0
- 测量功率:-59
由于报告原始 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):
- 信标 UUID:E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
- 主要 ID:(空)
- 未成年人 ID:(空)
- 问候语:入门测试
- 再见讯息:再见测试
然而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
文件中添加了相应的条目
我有 2 台设备,iPhone 5(作为信标)和 iPhone 5s(作为信标检测器),都带有 iOS 8.1。
两个设备都启用:
- 定位服务(隐私 > 定位服务 > 始终用于 AirLocate)
- 蓝牙
- Wi-Fi,加入具有互联网连接的相同 SSID(不太相关)
- iPhone5s有SIM卡,信号足够
- iPhone5没有SIM卡
在iPhone5中,我安装了Apple的AirLocatedemo,配置如下(在配置页面):
- 启用:是
- UUID:E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
- 专业:0
- 未成年人:0
- 测量功率:-59
由于报告原始 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):
- 信标 UUID:E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
- 主要 ID:(空)
- 未成年人 ID:(空)
- 问候语:入门测试
- 再见讯息:再见测试
然而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
文件中添加了相应的条目