0

I have an application which runs as both peripheral and central implementing CoreBluetooth.I use State Preservation and restoration using the willRestoreState in the view controller where the central manager is instantiated.I added the “bluetooth-central key” in info.plist.

The scenario i am testing is the when the central side application is terminated by OS while an active connection is established,the connection should be reestablished and restore state is called.But nothing is happening in the app in background.Can anyone figure it out?

vishnu_146
  • 437
  • 3
  • 14
  • It is almost always a bad idea for your CBCentralManager to be held by a view controller; when the app is launched in the background the view controller may not be instantiated. I suggest you create a singleton object to hold you central manager and then you can instantiate it in AppDelegate and get a reference in your view controller – Paulw11 Sep 30 '16 at 10:15
  • @Paulw11 Added singleton for central manager object.Still no luck.. – vishnu_146 Sep 30 '16 at 13:14
  • Maybe also have a look here: http://stackoverflow.com/questions/33130124/how-to-trigger-core-bluetooth-state-preservation-and-restoration – p2pkit Oct 13 '16 at 08:34

0 Answers0