1
试图获得核蓝牙状态恢复迅速在持续工作,但我只能似乎得到它开火一次,然后它不到目前为止不再回应...核心蓝牙状态恢复仅触发一次
我在我的课的init:
override init() {
super.init()
let centralQueue = dispatch_queue_create("com.domain.app", DISPATCH_QUEUE_SERIAL)
centralManager = CBCentralManager(delegate: self, queue: centralQueue, options: [CBCentralManagerOptionRestoreIdentifierKey: "myCentralManager", CBCentralManagerOptionShowPowerAlertKey: true])
}
和我WillRestoreState代表:
func centralManager(central: CBCentralManager, willRestoreState dict: [String : AnyObject]) {
let peripheral = dict[CBCentralManagerRestoredStatePeripheralsKey]
for peripheral in peripherals as! [CBPeripheral] {
showGenericNotification("BLE \(peripheral)")
peripheral.delegate = bleService
}
}
然后当我从BLE装置发送数据showNotification()把一个通知,我的通知中心..它只会触发一次,然后停止响应。 bleService是CBPeripheralDelegate的实例,用于管理外围设备
看起来似乎代理正在分配给bleService ...任何人都有任何想法?