Rightpoint / RZBluetooth

Core Bluetooth helper library
Other
136 stars 47 forks source link

sorry about question #63

Closed vicktor closed 7 years ago

vicktor commented 7 years ago

there is no issue, but, do you have an example of restorationHandler use?

sorry, thanks in advance

KingOfBrian commented 7 years ago

Hey @vicktor, this should behave exactly like the CBCentralManager callback. If your app is restored by the system, the callback will be passed an array of RZBPeripherals, as described in the documentation:

An array (an instance of NSArray) of CBPeripheral objects that contains all of the peripherals that were connected to the central manager (or had a connection pending) at the time the app was terminated by the system.

The CBPeripheral will be wrapped with RZBPeripherals and then the callback block is triggered. Often the next step is to check to make sure that the correct notify blocks are configured, but what needs to be done here varies on the application.

vicktor commented 7 years ago

Thanks Brian, please can you write some sample code? even if callback is empty.

thanks!

KingOfBrian commented 7 years ago

Something like this?

centralManager.restorationHandler = { peripherals in 
  for peripheral in peripherals {
    peripheral.doMyAppSyncThing()
  }
}
vicktor commented 7 years ago

yes!!!!

very thankful!!!

and again, sorry...

-- Victor

http://www.linkedin.com/in/victorbautista http://twitter.com/0x564242

On Mon, May 8, 2017 at 10:39 PM, Brian King notifications@github.com wrote:

Something like this?

centralManager.restorationHandler = { peripherals in for peripheral in peripherals { peripheral.doMyAppSyncThing() } }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Raizlabs/RZBluetooth/issues/63#issuecomment-299984240, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXUolpf8bCH_E4oF6Ilf9B1FdIXv6meks5r332cgaJpZM4NUGm8 .

KingOfBrian commented 7 years ago

Good luck!