From 4c3f0eae850ecf717d1739acd8ecc81b4fb1ff16 Mon Sep 17 00:00:00 2001 From: Philip Peitsch Date: Thu, 12 Sep 2024 10:15:28 +1000 Subject: [PATCH] Properly convert peripheral UUID for isConnected on iOS (#1033) --- src/ios/BLECentralPlugin.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ios/BLECentralPlugin.m b/src/ios/BLECentralPlugin.m index a6fc90cf..ace165c9 100644 --- a/src/ios/BLECentralPlugin.m +++ b/src/ios/BLECentralPlugin.m @@ -430,9 +430,13 @@ - (void)stopScan:(CDVInvokedUrlCommand*)command { - (void)isConnected:(CDVInvokedUrlCommand*)command { + NSUUID *uuid = [self getUUID:command argumentAtIndex:0]; + if (uuid == nil) { + return; + } + + CBPeripheral *peripheral = [self findPeripheralByUUID:uuid]; CDVPluginResult *pluginResult = nil; - CBPeripheral *peripheral = [self findPeripheralByUUID:[command argumentAtIndex:0]]; - if (peripheral && peripheral.state == CBPeripheralStateConnected) { pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; } else {