In my app, I need to write data into a writable characteristics of a peripheral. I am able to do this by following the process of scanning the peripherals, detecting and connecting to peripheral, discover services, discover characteristics and then finally write into the target characteristics.
After all this is done, I keep a reference of CBPheripheral and CBCharacteristic I am interested in. Now, next time, I am trying to directly write into the saved peripheral and characteristics. But I am getting below bluetooth warning. Can't we directly write into a Peripheral characteristics if we are not yet disconnected from it?
BTBeaconTest[1421:60b] CoreBluetooth[WARNING] is not a valid peripheral
[iPeripheral writeValue:dataToWrite forCharacteristic:iCharacterstic type:CBCharacteristicWriteWithResponse];
PS: I did not disconnect from the peripheral.