I am writing an app in swift using CoreBluetooth, and I'm looking for a way to reset CBPeripheralManager to the same state it's in when the app first starts up.
Asked
Active
Viewed 682 times
1
-
1I don't believe there's a way to "reset" like you're thinking/talking about. The closest you could get is probably deallocating it (by getting rid of all references to the `CBPeripheralManager` object) then reallocating a new one. However the state would still be preserved if I'm not mistaken. – Oxcug Jun 12 '15 at 22:28
-
Thanks, though I'm not sure I understand how to go about deallocating CBPeripheralManager. – Sam613 Jun 12 '15 at 23:15
-
It's really easy, just find where your @property (...) CBPeripheralManager *manager; is. And set it equal to nil. ARC will then deallocate the manager (given you don't have any more references to the manager. Just google ARC and look through a tutorial if you don't understand it – Oxcug Jun 12 '15 at 23:53