Skip to content

Commit

Permalink
Merge pull request #405 from srikanthkyatham/master
Browse files Browse the repository at this point in the history
Synchronizing the peripherals before iterating
  • Loading branch information
marcosinigaglia authored Nov 16, 2018
2 parents 36a03a8 + b32a1db commit a15d6c2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ios/BleManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,15 @@ - (NSString *) periphalManagerStateToString: (int)state
- (CBPeripheral*)findPeripheralByUUID:(NSString*)uuid {

CBPeripheral *peripheral = nil;

for (CBPeripheral *p in peripherals) {
@synchronized(peripherals) {
for (CBPeripheral *p in peripherals) {

NSString* other = p.identifier.UUIDString;
NSString* other = p.identifier.UUIDString;

if ([uuid isEqualToString:other]) {
peripheral = p;
break;
if ([uuid isEqualToString:other]) {
peripheral = p;
break;
}
}
}
return peripheral;
Expand Down

0 comments on commit a15d6c2

Please sign in to comment.