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!

  • 1
    It sounds like you are managing your bluetooth connection in the view controller. You should move this code out into a singleton class that is available to all viewcontrollers – Paulw11 Jul 25 '14 at 11:54

2 Answers2

0

you can give the service from the first view to the second and scan again for characteristics. double work, but it works ;) im not sure if you can only give the character to the second view. but you can try

Im also not very experienced programmer but this worked for me.

You want to be able to send and receive stuff in all views?

mond
  • 38
  • 6
0

Take the delegates and connected Peripheral device in singleton Instance. Through this you don't have to pass it every time.
See this answer for further reference.
BLE Peripheral disconnects when navigating to different ViewController

Mayank Verma
  • 108
  • 1
  • 8