Skip to content

Commit

Permalink
Updated stopAdvertisingBeacon method to handle crash when calling it …
Browse files Browse the repository at this point in the history
…when not advertising or CBPeripheralManager is off
  • Loading branch information
WillDent committed Nov 17, 2013
1 parent ad425a9 commit 9c4233a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Classes/OrgBeuckmanTibeaconsModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,17 @@ - (void)startAdvertisingBeacon:(id)args

- (void)stopAdvertisingBeacon:(id)args
{
[self.peripheralManager stopAdvertising];

NSLog(@"[INFO] Turned off advertising.");
if (self.peripheralManager) {

if (self.peripheralManager.state == CBPeripheralManagerStatePoweredOn){

[self.peripheralManager stopAdvertising];
NSLog(@"[INFO] Turned off advertising.");
}else{
NSLog(@"[INFO] peripheral manager state was off, no need to turn advertsing off");
}
}
}

#pragma mark - Beacon advertising delegate methods
Expand Down

0 comments on commit 9c4233a

Please sign in to comment.