From 9d3fad73a9b0bc5b47b031681125a3de3ea30fcf Mon Sep 17 00:00:00 2001 From: David Dolheguy Date: Thu, 26 Dec 2019 10:39:17 +0000 Subject: [PATCH 1/2] Fixed nil service data when braodcast by device --- ios/CBPeripheral+Extensions.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ios/CBPeripheral+Extensions.m b/ios/CBPeripheral+Extensions.m index 22dd3293..dc9052b0 100644 --- a/ios/CBPeripheral+Extensions.m +++ b/ios/CBPeripheral+Extensions.m @@ -111,8 +111,11 @@ - (NSDictionary *) serializableAdvertisementData: (NSDictionary *) advertisement NSLog(@"%@", serviceData); for (CBUUID *key in [serviceData allKeys]) { - [serviceData setObject:dataToArrayBuffer([serviceData objectForKey:key]) forKey:[key UUIDString]]; - [serviceData removeObjectForKey:key]; + [serviceData setObject:dataToArrayBuffer([serviceData objectForKey:key]) forKey:[key UUIDString]]; + if ([serviceData objectForKey:key]) { + [serviceData setObject:dataToArrayBuffer([serviceData objectForKey:key]) forKey:[key UUIDString]]; + [serviceData removeObjectForKey:key]; + } } // replace the Service Data object From d3edb15047399f534bef0949e402bc1898ab1b2a Mon Sep 17 00:00:00 2001 From: David Dolheguy Date: Thu, 26 Dec 2019 10:47:49 +0000 Subject: [PATCH 2/2] Fixed duplicate line --- ios/CBPeripheral+Extensions.m | 1 - 1 file changed, 1 deletion(-) diff --git a/ios/CBPeripheral+Extensions.m b/ios/CBPeripheral+Extensions.m index dc9052b0..832bac26 100644 --- a/ios/CBPeripheral+Extensions.m +++ b/ios/CBPeripheral+Extensions.m @@ -111,7 +111,6 @@ - (NSDictionary *) serializableAdvertisementData: (NSDictionary *) advertisement NSLog(@"%@", serviceData); for (CBUUID *key in [serviceData allKeys]) { - [serviceData setObject:dataToArrayBuffer([serviceData objectForKey:key]) forKey:[key UUIDString]]; if ([serviceData objectForKey:key]) { [serviceData setObject:dataToArrayBuffer([serviceData objectForKey:key]) forKey:[key UUIDString]]; [serviceData removeObjectForKey:key];