【发布时间】:2014-07-15 10:37:28
【问题描述】:
很奇怪,didEnterRegion 和 didExitRegion 在调用 startMonitoringForRegion 之后从未被解雇。此外,didDetermineState 可以按预期触发。
现阶段,我只评估基于Apple's sample code demo, Airlocated的iBeacon技术。
因此,我只实现了两个方法,包括APLAppDelegate.m文件中的didEnterRegion和didExitRegion如下:
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
NSLog(@"Entered region: %@", region);
[self sendLocalNotificationForBeaconRegion:(CLBeaconRegion *)region];
}
- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
{
NSLog(@"Exited region: %@", region);
}
尝试了以下步骤,但没有效果。
- 用 iOS7.1 重置 iPhone5/iPhone4s
- 配置后台模式和 *.plist 如下:
- 在项目信息或 info.plist --> 自定义 IOS 目标属性 --> .添加“所需的背景模式” .在此添加两个项目--> ."App 使用 CoreBluetooth 共享数据" .“应用注册位置更新”
- 在项目能力--> 有背景模式
.检查“位置更新”
.选中“充当蓝牙 LE 附件” .勾选“使用蓝牙 LE 配件”
- 授权应用程序访问设备位置。
那么,谁能给我一些建议?
提前致谢。
【问题讨论】:
-
尝试添加 region.notifyOnEntry = YES; region.notifyOnExit = YES;创建 CLBeaconRegion 之后。
-
感谢您的及时反馈,试用后很快就会更新状态。
-
Greg,将参数指定为“region.notifyOnEntry = YES; region.notifyOnExit = YES”后似乎没有效果
-
谢谢,格雷格。这是我第一次提出问题,而您是第一个在 stackoverflow.com 上给我回复的人。 ^_^^_^^_^^_^^_^^_^ 是时候为我离开办公室了。贝。
标签: ios objective-c bluetooth cllocationmanager ibeacon