Question: I am trying to initialize a central manager instance to make an app with Bluetooth connectivity.

This is part of my code:

```
class ViewController: UIViewController, CBCentralManagerDelegate {
   var myCentralManager = CBCentralManager(delegate: self, queue: nil) //error on this line
   func centralManagerDidUpdateState(central: CBCentralManager!) { 
}

```

I get an error:

> 
> "Type 'ViewController -> () -> ViewController!' does not conform to protocol 'CBCentralManagerDelegate'
> 
> 
> 

The only method required by the protocol is `centralManagerDidUpdateState()` which I have added, so why do I get an error?

Answer: 
When you create a central manager, the central manager calls centralManagerDidUpdateState method of its delegate object. So you have to implement this delegate method to ensure that Bluetooth low energy is supported and available to use the central device. Like below:

```
func centralManagerDidUpdateState(central: CBCentralManager!){
    println("CentralManager is initialized")

    switch central.state{
    case CBCentralManagerState.Unauthorized:
        println("The app is not authorized to use Bluetooth low energy.")
    case CBCentralManagerState.PoweredOff:
        println("Bluetooth is currently powered off.")
    case CBCentralManagerState.PoweredOn:
        println("Bluetooth is currently powered on and available to use.")
    default:break
    }
}

```
The code does not conform to the CBCentralManagerDelegate because the method "func centralManagerDidUpdateState(central: CBCentralManager!)" needs to be added to the class that is of type CBCentralManager. Not the view controller type. You have to create a new class of type CBCentralManager. Here is my solution to the problem you are referencing above:

```
//
//  ViewController.swift
//  BLECentral
//
//  Created by Sophronis Mantoles on 11/17/15.
//  Copyright Â© 2015 Sophronis Mantoles. All rights reserved.
//

import UIKit
import CoreBluetooth

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

@IBOutlet var statusLabel: UILabel!
var bleManager: BLEManager!

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

@IBAction func showStatus(sender: AnyObject) {

    func centralManager(central: CBCentralManager!,
        didDiscoverPeripheral peripheral: CBPeripheral!,
        advertismentData: [NSObject : AnyObject]!,
        RSSI: NSNumber!)
    {
    statusLabel.text = ("\(peripheral.name) : \(RSSI) dBm")
    }
        }
      }
  class BLEManager {
    var centralManager : CBCentralManager!
    var bleHandler : BLEHandler // delegate
    init() {
    self.bleHandler = BLEHandler()
    self.centralManager = CBCentralManager(delegate: self.bleHandler, queue:       nil)
      }
 }

class BLEHandler : NSObject, CBCentralManagerDelegate {
override init () {
    super.init()
}

func centralManagerDidUpdateState(central: CBCentralManager){
    switch (central.state)
    {
    case.Unsupported:
        print("BLE is not supported")
    case.Unauthorized:
        print("BLE is unauthorized")
    case.Unknown:
        print("BLE is Unknown")
    case.Resetting:
        print("BLE is Resetting")
    case.PoweredOff:
        print("BLE service is powered off")
    case.PoweredOn:
        print("BLE service is powered on")
    default:
        print("default state")
       }
    }
 }

```