I setup a few BLE connections in my view controller, SViewController, and I need to store the peripherals for use in other view controllers. I've tried creating an NSUserDefault object and storing the peripherals in there, but I got the error "Attempt to insert non-property value"
, and it never inserted. I then tried wrapping it up in an NSData object and storing it in NSUserDefaults, but got the error "-[CBConcretePeripheral encodeWithCoder:]: unrecognized selector sent"
and the app crashed. So that definitely did not work. I've also tried making the three CBPeripheral variables global, but I ran into a ton of issues with that. (I'm still very new to programming). I then looked into somehow caching them, but have read on here that it will not work and to not waste the time.
Does anyone know how to store a CBPeripheral object so that I can access it and initialize it in other view controllers?