我正在尝试列出所有蓝牙连接的音频设备 . 但是委托函数没有登录 . 也尝试了Switching audio output between Receiver and Speaker in iOS7 and above?的解决方案

以下是我的代码......

import UIKit
import CoreBluetooth
import AVFoundation

class ViewController: UIViewController, CBCentralManagerDelegate, CBPeripheralManagerDelegate {

override func viewDidLoad() {
    super.viewDidLoad()

    do{
        try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: AVAudioSessionCategoryOptions.AllowBluetooth)
    } catch{
        print(error)
    }

    let manager = CBCentralManager.init(delegate: self, queue: nil)
    manager.scanForPeripheralsWithServices(nil, options: nil)
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
}

func centralManagerDidUpdateState(central: CBCentralManager) {
    print(central.state)
}

func centralManager(central: CBCentralManager, didDiscoverPeripheral peripheral: CBPeripheral, advertisementData: [String : AnyObject], RSSI: NSNumber) {
    print(peripheral)
}

func peripheralManagerDidUpdateState(peripheral: CBPeripheralManager) {
    print(peripheral)
}

}

就我而言,有一个音频播放器和一个按钮(就像音乐中的默认播放按钮) . 单击该按钮,它应显示所有连接的蓝牙设备 . 是否可以列出所有设备?此外,我无法使用Apple的MKVolumeView,因为我必须进一步创建一个cordova插件 .