@@ -28,7 +28,7 @@ class PeripheralManager: NSObject {
2828 self . peripheralManager = CBPeripheralManager (
2929 delegate: self ,
3030 queue: nil ,
31- options: [ CBPeripheralManagerOptionShowPowerAlertKey: true ]
31+ options: [ CBPeripheralManagerOptionShowPowerAlertKey: false ]
3232 )
3333
3434 while !isPoweredOn { Thread . sleep ( forTimeInterval: 0.05 ) }
@@ -58,7 +58,9 @@ class PeripheralManager: NSObject {
5858 self . indicationCharacteristic = CBMutableCharacteristic (
5959 type: CBUUID ( string: indicationCharacteristicUUID) , properties: [ . indicate] , value: nil ,
6060 permissions: [ . writeable] )
61- guard let wc = self . writeCharacteristic, let ic = self . indicationCharacteristic,
61+ guard
62+ let wc = self . writeCharacteristic,
63+ let ic = self . indicationCharacteristic,
6264 let s = self . service
6365 else {
6466 throw PeripheralManagerError . NotConnectedToCentral
@@ -76,11 +78,11 @@ class PeripheralManager: NSObject {
7678 }
7779
7880 func stopAdvertising( ) throws {
79- guard let service = self . service else {
81+ guard self . service != nil else {
8082 throw PeripheralManagerError . NoDefinedService
8183 }
8284 self . peripheralManager. stopAdvertising ( )
83- }
85+ }
8486
8587 func indicate( message: Data ) throws {
8688 guard let connectedCentral = connectedCentral else {
0 commit comments