Skip to content

Commit

Permalink
Synchronizing the peripherals before iterating
Browse files Browse the repository at this point in the history
  • Loading branch information
sriky committed Nov 16, 2018
1 parent 36a03a8 commit b32a1db
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 b32a1db

Please sign in to comment.