gpt4 book ai didi

ios - AirLocate 和 BeaconDemo : not showing up

转载 作者:行者123 更新时间:2023-11-28 21:52:18 25 4
gpt4 key购买 nike

我有 2 台设备,iPhone 5(充当 Beacon)和 iPhone 5s(充当 Beacon Detector),均装有 iOS 8.1。

两个设备都启用:

  • 定位服务(隐私 > 定位服务 > 始终用于 AirLocate)
  • 蓝牙
  • Wi-Fi,加入具有互联网连接的相同 SSID(不太相关)
  • iPhone 5s有SIM卡,信号够强
  • iPhone 5 没有 SIM 卡

在 iPhone 5 中,我安装了 Apple 的 AirLocate演示和配置如下(在配置页面):

  • 启用:是
  • 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 5s 中,我安装了 Beacon Demo并配置如下(添加一个新的 Beacon):

  • 信标 UUID:E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
  • 主要 ID:(空)
  • 未成年人 ID:(空)
  • 问候语:入学测试
  • 再见讯息:再见测试

然而,iPhone 5 并没有出现在 iPhone 5s 中,一直声称“Not In Range”。我错过了什么?


截图:

Left: AirLocate; Right: Beacon Demo

左: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 中添加的必要权限。

执行此操作时,请确保您还在 Info.plist 文件中添加了相应的条目,如 here. 所述。

关于ios - AirLocate 和 BeaconDemo : not showing up,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27853809/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com