ReadRSSI不会调用委托方法 [英] ReadRSSI doesn't call the delegate method

查看:194
本文介绍了ReadRSSI不会调用委托方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我,因为iOS的8更新出了问题,现在我的应用程序连接到BLE设备和RSSI得益于定时器和 ReadRSSI 方法定期读取。

I got a problem since the iOS 8 update, right now my app is connected to a BLE device and periodically reads the RSSI thanks to a timer and the ReadRSSI method.

readRSSI 方法被调用(使用断点检查),所以直到此时一切都很好。

The readRSSI method is called (checked with a breakpoint) so until this point everything is fine.

根据文档调用 readRSSI 应触发回调

According to the documentation calling the readRSSI should trigger the callback

- (void)peripheral:(CBPeripheral *)peripheral didReadRSSI:(NSNumber *)RSSI error:(NSError *)error

不过,这种委托方法不叫每次。但是,当我切换蓝牙手机和关闭,我回来了RSSI更新。有没有人已经遇到这个问题?如何管理解决?

However, this delegate method is not called every time. But when I toggle the phone bluetooth off and on, I get back the RSSI updates. Has anyone already encountered this problem? How can i manage to fix it?

推荐答案

我得到了同样的问题,首先想到的可能是我的错,但后来事实证明是非常奇怪的。

I got the same problem, first thought it might be my fault, but later it turns out to be really weird.

我写了类似的程序,用iPhone连接到BLE灯塔,并使用[CBPeripheral readRSSI]获得的信号强度。当BLE信标连接到我的iPhone首次一切顺利流畅。但是,如果它断开了,再重新连接,方法readRSSI不会被调用了。
我重新启动蓝牙在我的iPhone只有经过,这个问题将得到解决。

I wrote similar program, using iPhone to connect to a BLE beacon, and use [CBPeripheral readRSSI] to get the signal strength. Everything goes smooth when the BLE beacon is connected to my iPhone for the first time. But if it got disconnected, and reconnect again, the method readRSSI won't get called any more. Only after I restart the bluetooth on my iPhone, the issue will be resolved.

我在调试模式下,一步步运行程序,出乎我的意料,我发现一点问题都没有。即使我断开了这么多次,再重新连接,方法readRSSI仍然可以正常调用。

I run the program in debug mode, step by step, to my surprise, I found no problem at all. Even I disconnect for so many times and reconnect again, the method readRSSI can still be called properly.

希望这可以帮助。我还等着这个奇怪的答案。

Hope this may help. I am also waiting for an answer for this strange thing.

这篇关于ReadRSSI不会调用委托方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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