I connect to the peripheral, read a characteristic, then disconnect.
I’m finding that sometimes when the peripheral has been backgrounded and the app killed from memory it can still be discovered fine (now I use the restoration ID) and has the correct service and characteristic UUID’s, however when I try to read the characteristic it gives the error “Unknown error”.
Nov 9 08:15:31 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: Scanning started
Nov 9 08:15:31 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: -[BTScanViewController scanningStarted]
Nov 9 08:15:31 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: -[BTServerSingleton centralManager:didDiscoverPeripheral:advertisementData:RSSI:]
Nov 9 08:15:31 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: Did discover peripheral. peripheral: <CBPeripheral: 0x1700ba7c0 identifier = 34B922CF-4911-697F-07B2-C448DB882D7D, Name = "iPad", state = disconnected> rssi: -38, Name: iPad advertisementData: {
kCBAdvDataChannel = 38;
kCBAdvDataHashedServiceUUIDs = (
"Unknown (<92593d70 d32c4d5a 88600fb5 04e657b4>)"
);
kCBAdvDataIsConnectable = 1;
}
Nov 9 08:15:31 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: Connecting to peripheral <CBPeripheral: 0x1700ba7c0 identifier = 34B922CF-4911-697F-07B2-C448DB882D7D, Name = "iPad", state = disconnected>
Nov 9 08:15:31 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: Peripheral Connected successfully: <CBPeripheral: 0x1700ba7c0 identifier = 34B922CF-4911-697F-07B2-C448DB882D7D, Name = "iPad", state = connected> with UUID: <__NSConcreteUUID 0x178221940> 34B922CF-4911-697F-07B2-C448DB882D7D
Nov 9 08:15:32 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: -[BTServerSingleton peripheral:didDiscoverServices:]
Nov 9 08:15:32 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: Services count:1
Nov 9 08:15:32 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: Found Unknown (<92593d70 d32c4d5a 88600fb5 04e657b4>)
Nov 9 08:15:32 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: -[BTServerSingleton peripheral:didDiscoverCharacteristicsForService:error:]
Nov 9 08:15:32 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: Characteristics found:Unknown (<4e7a08a9 558f4b03 a404818e 0d19eb05>)
Nov 9 08:15:32 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: Found name characteristic, going to read it
Nov 9 08:15:42 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: (null)
Nov 9 08:15:42 Darrens-iPhone-5s Bluetooth-Test[141] <Warning>: Error discovering characteristics: Unknown error.