저는 swift3 프로젝트에서 블루투스가 활성화되었는지 여부를 알아야합니다. 나는이 주제에 대한 항목을 많이 읽는했지만 그들 중 누구도이 centralManagerDidUpdateState
CBPeripheralManager를 사용하지 않고 블루투스 켜기/끄기 상태를 얻으십시오.
를 사용하는 것보다 나에게 다른 방법으로 그것을 할 도울 수있는 사실이 코드가 있습니다
private func GetBluetoothInformation() {
let options = [CBCentralManagerOptionShowPowerAlertKey:0]
bluetoothPeripheralManager = CBPeripheralManager(delegate: self, queue: nil, options: options)
}
func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager) {
var status: Bool = false
switch peripheral.state {
case .poweredOn:
status = true
default:
status = false
}
m_session_chofer?.setIsBluetooth(status)
}
을하지만이 같은 수행하여, I GetBluetoothInformation
을 호출 할 때마다 정확하게 상태를 업데이트할지 여부를 모릅니다.
그래서 당신이 도구를 사용하여 블루투스 얘기가 아니라 할 애플은 블루투스와 통신하기 위해 제공 했습니까? – CodeBender
'CBPeripheralManager'를 사용하지 않고 CBPeripheralManager를 사용하는 다른 방법이 있는지 알고 싶다면 – Snoobie