简体   繁体   English

iOS BLE在连接后立即断开连接,只有重启设备才有帮助

[英]iOS BLE disconnecting right after connection, only restarting device helps

My app uses BLE (Bluetooth 4) to connect to a physical peripheral. 我的应用程序使用BLE(蓝牙4)连接到物理外围设备。 My users and I have repeatedly encountered a bug where, at some point, the app stops connecting to the peripheral - you can see an indication that the BLE peripheral is discovered and the connection was established, but then few seconds after, the connection is dropped. 我的用户和我一再遇到一个错误,在某些时候,应用程序停止连接到外围设备 - 您可以看到发现BLE外围设备并建立连接的指示,但几秒钟之后,连接被丢弃。

Things go back to normal only after restarting the iDevice. 只有在重新启动iDevice后,事情才会恢复正常。

I've done a very long work on checking it and researched this issue thoroughly, until I got to the conclusion that this must be a bug in iOS (tested with 7.1, but probably occurs on 8.0 as well). 我已经做了很长时间的检查,并彻底研究了这个问题,直到我得出结论,这必定是iOS中的一个错误(用7.1测试,但也可能发生在8.0上)。

My tests and findings: 我的测试和发现:

  • Occurs with every BLE supporting iDevice. 每个支持iDevice的BLE都会发生。
  • Occurs with both my own BLE peripheral and with other 3rd party BLE products, both known to work perfectly in normal cases. 与我自己的BLE外设和其他第三方BLE产品一起发生,两者都知道在正常情况下可以完美地工作。
  • It can sometimes work well for even 50 launches, but then eventually it'll fail. 它有时可以很好地适用于50次发射,但最终它会失败。
  • Network & factory settings reset did not help. 网络和出厂设置重置没有帮助。
  • Tested and occurred with various applications: ## 经过各种应用测试和发生:##
    • My own app. 我自己的应用程序
    • Clean new Xcode project that's only scanning for peripherals and trying to connect to the first and only discovered peripheral. 清理新的Xcode项目,该项目仅扫描外围设备并尝试连接到第一个也是唯一一个发现的外围设备。
    • Apple's BLE example app: Health Thermometer (with relevant modifications since I don't have this particular peripheral). Apple的BLE示例应用程序: Health Thermometer (由于我没有这个特定的外围设备,因此进行了相关修改)。
    • 3rd party apps, including the generic LightBlue . 第三方应用程序,包括通用LightBlue
    • Important note: Every one of the options above worked perfectly for a while (multiple launches), at some point suddenly stopped and then worked again after a restart of the device. 重要提示:上述每个选项都可以完美地工作一段时间(多次启动),在某些时候突然停止,然后在重启设备后再次工作。
  • The connection procedure seems to fail when trying to discover the peripheral's services - ie it gets discovered and connected normally, but when initiating discovery of services, it stops responding (didDiscoverServices isn't called). 尝试发现外围设备的服务时,连接过程似乎失败 - 即它被正常发现和连接,但是当启动服务发现时,它会停止响应(不会调用didDiscoverServices)。
  • I have of course tried many approaches found online with no luck. 我当然尝试了许多在线发现但没有运气的方法。

Can anyone shed some light on this problem? 任何人都可以解释这个问题吗?

  • Is it a known issue? 这是一个已知的问题吗?
  • Was it fixed in a recent iOS update? 是否在最近的iOS更新中修复了?
  • Is it going to be fixed? 它会被修复吗?

You can imagine the negative affect such an issue has on my users' experience, as BLE connection is essential to the product. 您可以想象这样的问题对我的用户体验产生的负面影响,因为BLE连接对于产品至关重要。

I'll appreciate your advice and suggestions on how to solve it. 我将非常感谢您就如何解决问题提出建议和意见。

Thanks! 谢谢!

Update: 更新:

Apple responded to my tech support request: Apple回应了我的技术支持请求:

Bottom line(s): 底线:

  • They said they had fixed some BLE related bugs in iOS 8 and urging us to test if it still happens in iOS 8. 他们说他们已经在iOS 8中修复了一些与BLE相关的错误,并敦促我们测试它是否仍然发生在iOS 8中。
  • They said to start with that and if not, try to diagnose the problem with a utility app they provide. 他们说从那开始,如果没有,尝试使用他们提供的实用程序应用来诊断问题。

So far for me it didn't happen with iOS 8, but on the other hand I can see posts about other Bluetooth issues , that are not necessarily related but who knows. 到目前为止,iOS 8并没有发生这种情况,但另一方面,我可以看到有关其他蓝牙问题的帖子,这些问题 不一定相关,但谁知道。

Full answer: 完整答案:

I'm responding to your finding that you and your customers find that after some point of use, iOS BLE fails to maintain a connection. 我回应你的发现,你和你的客户发现在使用一段时间后,iOS BLE无法保持连接。 You indicate that the problem was identified with iOS 7.1. 您表明问题已通过iOS 7.1识别。 There have been issue regarding iOS BLE which have been reported and have been fixed with iOS 8.0. 有关iOS BLE的问题已经报道并已通过iOS 8.0修复。 To best determine whether your issue has been addressed, of course the simplest means would be to install iOS 8 and to see if the issue can be replicated. 为了最好地确定您的问题是否已得到解决,当然最简单的方法是安装iOS 8并查看问题是否可以复制。 However, as you report that you can replicate the problem on your deivce with iOS 7.1 the first thing would be to obtain the Bluetooth Server profile, install it to your deivce, replicate the problem, then obtain a BLE Server log when the problem occurs. 但是,当您报告可以使用iOS 7.1复制问题时,首先要获取蓝牙服务器配置文件,将其安装到您的deivce,复制问题,然后在出现问题时获取BLE服务器日志。 The profile will have the BLE server report additional logging details which can help to report issues that the server encounters. 该配置文件将让BLE服务器报告其他日志记录详细信息,这有助于报告服务器遇到的问题。 We can see if the issue is one which has been reported previously. 我们可以看看问题是否是之前报道的问题。 Something to consider is that for all new bug report issues, Core Bluetooth engineering is requesting that all issues be regressed with the currently shipping version of iOS - that is 8.0. 需要考虑的是,对于所有新的错误报告问题,Core蓝牙工程师要求使用当前发布的iOS版本(即8.0)回退所有问题。 For customers with iOS 7.x, there will be no more iOS 7 updates - all software fixes and bug fixes will be with iOS 8. For this reason, only issues which are reported with iOS 8 will be investigated. 对于使用iOS 7.x的客户,将不再有iOS 7更新 - 所有软件修复和错误修复都将在iOS 8中使用。因此,只会调查iOS 8报告的问题。 You can obtain the BLE server profile from the Apple Developer bug report web page https://developer.apple.com/bug-reporting/ios/bluetooth/ . 您可以从Apple Developer错误报告网页https://developer.apple.com/bug-reporting/ios/bluetooth/获取BLE服务器配置文件。 The instructions for installing the profile and capturing the log, are presented on the web page. 安装配置文件和捕获日志的说明显示在网页上。 If you capture a log with iOS 7.x, you can send it to me for review. 如果您使用iOS 7.x捕获日志,则可以将其发送给我进行审核。 However, this will be somewhat of an academic exercise - to know if iOS solves the issue, or whether it persists, we will need to see if the issue occurs under iOS 8. Something to keep in mind, once you update a device to iOS 8, you will not be able to restore it to a previous version. 然而,这将是一个学术练习 - 要知道iOS是否解决了这个问题,或者它是否仍然存在,我们需要看看问题是否发生在iOS 8下。一旦你将设备更新到iOS,需要记住一些事情8,您将无法将其还原到以前的版本。 I'm happy to review your results. 我很高兴看看你的结果。 If however, the problem persists under iOS 8, it's best to submit a bug report to get Core Bluetooth engineering's attention on this matter. 但是,如果问题仍然存在于iOS 8下,最好提交错误报告以获得Core Bluetooth工程师对此事的关注。 You can submit a bug report using the Apple Developer bug report web page. 您可以使用Apple Developer错误报告网页提交错误报告。 - http://bugreport.apple.com - http://bugreport.apple.com

所以看起来问题是通过最近的iOS更新(8.0或8.1)解决的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM