iBeacon显示蓝牙didEnterRegion和didExitRegion方法从来没有发射 [英] iBeacon Bluetooth didEnterRegion and didExitRegion methods are never fired

查看:536
本文介绍了iBeacon显示蓝牙didEnterRegion和didExitRegion方法从来没有发射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是非常奇怪的是, didEnterRegion didExitRegion startMonitoringForRegion 被调用。此外, 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波纹管:


  

      
  1. 在项目信息或info.plist中 - >
           自IOS目标属性 - >
                      。加上所需的背景模式
                      。在这种添加两个项目 - >
                                  应用程序使用共享数据CoreBluetooth
                                  应用程序注册了位置更新

  2.   
  3. 在项目的能力 - >
           有背景模式结果
                     。勾选Loaction更新结果
                     。检查作为一个蓝牙LE配件
                     。勾选使用蓝牙LE附件

  4.   


  • 授权访问设备位置的应用程序。

所以,任何人都可以给我一些建议就可以了?

先谢谢了。


解决方案

添加 startRangingBeaconsInRegion startMonitoringForRegion 方法,并尝试再次

[_的LocationManager startRangingBeaconsInRegion:demoRegion]; // demoRegion - 区域你已经创建

It's very strange that didEnterRegion and didExitRegion are never fired after startMonitoringForRegion 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 and didExitRegion in the file APLAppDelegate.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:

  1. 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"
  2. 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 after startMonitoringForRegion and try again

[_locationManager startRangingBeaconsInRegion:demoRegion]; // demoRegion - region you have created

这篇关于iBeacon显示蓝牙didEnterRegion和didExitRegion方法从来没有发射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆