iBeacon显示蓝牙didEnterRegion和didExitRegion方法从来没有发射 [英] iBeacon Bluetooth didEnterRegion and didExitRegion methods are never fired
问题描述
这是非常奇怪的是, didEnterRegion
和 didExitRegion
在 startMonitoringForRegion $从未被触发C $ C>被调用。此外,
didDetermineState
可以作为触发预期。
在目前的阶段,我只是根据<一个评估iBeacon显示技术href=\"https://developer.apple.com/library/ios/sample$c$c/AirLocate/Introduction/Intro.html#//apple_ref/doc/uid/DTS40013430-Intro-DontLinkElementID_2\"相对=nofollow>苹果的样品code演示,Airlocated 。
所以,我只能实现两个方法,包括 didEnterRegion
和 didExitRegion
在文件 APLAppDelegate.m
波纹管:
- (空)的LocationManager:(CLLocationManager *)经理didEnterRegion:(CLRegion *)区域
{
的NSLog(@输入的区域:%@,区);
[个体经营sendLocalNotificationForBeaconRegion:(CLBeaconRegion *)区];
} - (无效)的LocationManager:(CLLocationManager *)经理didExitRegion:(CLRegion *)区域
{
的NSLog(@退出的区域:%@,区);
}
娄步骤已经尝试过,但没有效果。
- 重置的iPhone5 /的iPhone4s与iOS7.1
- 配置背景模式*的.plist波纹管:
- 在项目信息或info.plist中 - >
自IOS目标属性 - >
。加上所需的背景模式
。在这种添加两个项目 - >
应用程序使用共享数据CoreBluetooth
应用程序注册了位置更新
- 在项目的能力 - >
有背景模式结果
。勾选Loaction更新结果
。检查作为一个蓝牙LE配件
。勾选使用蓝牙LE附件
块引用>
- 授权访问设备位置的应用程序。
所以,任何人都可以给我一些建议就可以了?
先谢谢了。
解决方案添加
startRangingBeaconsInRegion
在startMonitoringForRegion
方法,并尝试再次
[_的LocationManager startRangingBeaconsInRegion:demoRegion];
// demoRegion - 区域你已经创建It's very strange that
didEnterRegion
anddidExitRegion
are never fired afterstartMonitoringForRegion
is called. In addition,didDetermineState
could be triggered as expectation.During the current stage, I only evaluate the iBeacon tech based on Apple's sample code demo, Airlocated.
Therefore, I only implement two methods, including
didEnterRegion
anddidExitRegion
in the fileAPLAppDelegate.m
as bellow:- (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); }
Bellow steps have been tried, but no effect.
- Reset iPhone5/iPhone4s with iOS7.1
- Configure the background mode and *.plist as bellow:
- in project info or info.plist --> Custom IOS Target Properties --> . add "Required background modes" . in this add two items --> ."App shares data using CoreBluetooth" ."App registers for location updates"
- in project Capability --> There is Background Modes
. check "Loaction update"
. check "Acts as a Bluetooth LE accessory" . check "uses bluetooth LE accessories"
- Authorize the application to access the device location.
So, could anyone give me some suggestion on it?
Thanks in advance.
解决方案Add
startRangingBeaconsInRegion
method afterstartMonitoringForRegion
and try again
[_locationManager startRangingBeaconsInRegion:demoRegion];
// demoRegion - region you have created这篇关于iBeacon显示蓝牙didEnterRegion和didExitRegion方法从来没有发射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!