0

So far I am able to connect to the peripheral fine and can send commands to it, but when I select a new tab the connection state goes to IDLE and I can't send anything from the next tab, but I can go back to the first tab and can send the commands just fine again. I am not the most experienced programmer, and I have been stuck here for a while now. So any help at all would be appreciated. When I created the tab bar controller I did not add any code to the .h or .m files... not sure if that could be a problem or not, I had a working first page then added the TBC and five other view controllers then connected them all together. I just want the connection to stay through tabs, as going back and forth between them will be happening often.

Thanks!

4

2 回答 2

0

您可以将服务从第一个视图提供给第二个视图,然后再次扫描特征。双重工作,但它有效;)我不确定你是否只能将角色赋予第二个视图。但你可以试试

我也不是很有经验的程序员,但这对我有用。

您希望能够在所有视图中发送和接收内容吗?

于 2014-07-25T10:52:21.897 回答
0

在单例实例中获取代表和连接的外围设备。通过这个你不必每次都通过它。
请参阅此答案以获取更多参考。
导航到不同的 ViewController 时 BLE 外围设备断开连接

于 2018-12-07T07:50:41.200 回答