简体   繁体   English

Ble外设断开

[英]Ble peripheral are disconnected

I am using ble peripheral tag. 我正在使用ble外围标签。 After scanning, I found identifier and name. 扫描后,我找到了标识符和名称。

When I click on any cell, the desire peripherals are connected, and button in peripherals tag will detect and didUpdateValueForCharacteristic methods are called on button click. 当我单击任何单元格时,将连接所需的外围设备,并且外围设备标签中的按钮将检测到,单击按钮时将调用didUpdateValueForCharacteristic方法。

But when we are moving to another screen, the button will not detect and peripheral will disconnect. 但是当我们移到另一个屏幕时,该按钮将无法检测到并且外围设备将断开连接。

Once the peripherals are connected, I want them always connected until app is not suspended. 连接外围设备后,我希望它们始终保持连接状态,直到应用程序未挂起。

The application is working on same screen. 该应用程序在同一屏幕上工作。

You are doing correct thing to show the peripherals in the screen but the connected methods you should not implement in the same screen. 您正在做正确的事情以在屏幕上显示外围设备,但是不应在同一屏幕上实现连接的方法。 Better all the connection methods including didUpdateValueForCharacteristic method you can implement in AppDelegate and use AppDelegate array to show the data in your main screen. 更好的是所有连接方法,包括可以在AppDelegate中实现并使用AppDelegate数组在主屏幕中显示数据的didUpdateValueForCharacteristic方法。 This will solve your problem and it will work without any problem. 这样可以解决您的问题,并且可以正常工作。 If you still face any issue then please tell us and I will try to solve your issue. 如果您仍然遇到任何问题,请告诉我们,我们将尽力解决您的问题。

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

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