2017-11-30 5 views

답변

0

BLE가 기존 블루투스 및 connects and disconnects to peripherals과 다르게 작동하므로 다소 혼란 스럽습니다.

나는 중앙 관리자를 통해 잠금 장치에 연결 중이며 주변 장치에 대한 참조를 제거해야한다고 가정합니다. 그렇다면, BLE 연결이 바로 분리 이벤트 리스너에 주변의 모든 refereneces을 취소 할 필요가 처리하는 객체 : 그것은에 방송 범위에있는 경우

func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) { 
// Something disconnected, check to see if it's our peripheral 
// If so, clear active device/service 
if peripheral == self.blePeripheral { 
    self.blePeripheral = nil 
    self.bleService = nil 
} 

// Scan for new devices using the function you initially connected to the perhipheral 
    self.scanForNewDevices() 
} 

귀하의 주변을 다시 연결해야합니다.