Saturday, 15 May 2010

ios - Class does not confirm to Protocol CBPeripheralManagerDelegate -


I am new to iOS Swift Development, I am implementing a Peripheral Handler in which I am starting an example of CBPherpal Manager. I have implemented the required representative methods but still showing this error 'type peripheralHandler - & gt; () - & gt; PeripheralHandler! 'CBPeripheralManagerDelegate does not confirm it.

  Foundation Import Import Core Bluetooth Class Periferlhandlr: Ansobijekt, Sibeeprfeyrlmanejrdileget {var myPerifheralManager = CBPeripheralManager (Representative: self-line: zero) func peripheral Mandkadikrit management (peripheral: Sibeeprferl manager PrintLn ( "BLE on") case CBPeripheralManagerState.Unknown: println ( "" known as) "(printable)" (println ( "peripheralManagerDidUpdateState called !!!") switch peripheral.state {case CBPeripheralManagerState.PoweredOff: println ( "BLE OFF") Case CBPeripheralManagerState.PoweredOn: Println ("BLE Not Summer Default "): println (" error ")}}}  
/ div>

this is a confusing error message that you can not self in the initial assignment of variable example. when instance variables instantiated itself needed anything necessary is not meaningful, because Swift is not allowed to use your own

you can use a lazy variable:

  lazy var myPerifheral Manager: CBPeripheralManager = {return CBPeripheralManager (W Ratinidi: self-line: zero)} ()  

When you first log in myPerifheralManager , this block will be called, and it made object to your Will give


No comments:

Post a Comment