ios - why isn't the CBPeripheralManagerDelegate method calling? -


why isn't cbperipheralmanagerdelegate method callinga although have initialized class var bluetoothmanager = cbperipheralmanager(delegate: self, queue: nil, options: nil)

and added bluetooth framework in bundle.

import uikit import corebluetooth  class appsettingsviewcontroller: uiviewcontroller {        override func viewdidload() {         super.viewdidload()         var bluetoothmanager = cbperipheralmanager(delegate: self, queue: nil, options: nil)       }      override func didreceivememorywarning() {         super.didreceivememorywarning()         // dispose of resources can recreated.     }   }  extension appsettingsviewcontroller : cbperipheralmanagerdelegate{       func peripheralmanagerdidupdatestate(peripheral: cbperipheralmanager!) {          if peripheral.state == cbperipheralmanagerstate.poweredon{              println("broadcasting")            }else if peripheral.state == cbperipheralmanagerstate.poweredoff{              println("no bluetooth found")          }else if peripheral.state == cbperipheralmanagerstate.unauthorized {              println("this option not allowed application")          }      }   } 

make bluetoothmanager instance variable. gets deallocated when viewdidload() finishes.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -