From 18a20fa8b2df282997ef3e0a2e5d766ca8b1fa1e 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 {