【发布时间】:2014-07-16 03:09:27
【问题描述】:
这是基于iBeacon Bluetooth didEnterRegion and didExitRegion methods are never fired中的问题的进一步问题,已解决。
具体来说,didEnterRegion 和 didExitRegion 方法在信标应用程序在后台或设备锁定时不会触发。另外,这两种方法可以在beacon应用在前面时正常触发。
我的应用程序基于以下链接中的苹果演示“Airlocated(示例代码,由苹果公司提供)”: https://developer.apple.com/library/ios/samplecode/AirLocate/Introduction/Intro.html#//apple_ref/doc/uid/DTS40013430-Intro-DontLinkElementID_2。我几乎没有修改任何代码除了添加一些代码如下:
在文件“APLAppDelegate.m”中
- (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);
}
在 APLMonitoringViewcontroller.m 文件中
- (void)updateMonitoredRegion
{
...
[self.locationManager startMonitoringForRegion:region];
[self.locationManager startRangeingForRegion:region];
...
}
补一下。我尝试了以下方法:
- 将“位置更新”后台模式设置为“是”
- 将 notifyOnExit 和 notifyOnEntry 指定为 true
- 用 iOS 7.1.2 重启 iPhone4s
谁能给我一些建议?
【问题讨论】:
标签: ios objective-c bluetooth cllocationmanager ibeacon