I want to make an ios app that use bluetooth to communicate. I am using swift.
So first I add the CoreBluetooth.framework, then I add a bridge.h and add file to the system bridge, import "CoreBluetooth/CoreBluetooth.h".
Then I create a new class,
import UIKit
class BTCentral: NSObject, CBCentralManagerDelegate {
}
I am planning to create a bluetooth CBCentralManager in that class. However, the above code gives me an error.
Type 'BTCentral' does not conform to protocol 'CBCentralManagerDelegate'
Here is a specific ScreenShot: click here
Any help will be appreciated! Thank you guys so much for your time.
You have to implement all the methods required by the protocol. In this case, CBCentralManagerDelegate only requires that one method be implemented, centralManagerDidUpdateState()
.
Add this method to your class and the error will go away.
func centralManagerDidUpdateState(central: CBCentralManager!) {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With