无法连接Whish Bluetooth Thermal Printer 4.0 BLE

时间:2019-08-31 13:45:46

标签: ios swift bluetooth core-bluetooth thermal-printer

我正在尝试将微型蓝牙打印机连接到我的iOS应用程序, 首先,我无法通过“设置”->“蓝牙”进行连接,因此,在线检查后,我发现需要从应用商店Whish下载特定的应用,下载该应用后,仅从应用enter image description here

连接并打印

如果应用程序不在后台,则我无法将iphone连接到打印机,我也无法选择从蓝牙断开打印机的连接,以下设置是我检查蓝牙设备的代码:

import UIKit
import CoreBluetooth


class ViewController: UIViewController {

    var centralManager: CBCentralManager!


    override func viewDidLoad() {
        super.viewDidLoad()
        centralManager = CBCentralManager(delegate: self, queue: nil) 
    }

}


extension ViewController : CBCentralManagerDelegate {
    func centralManagerDidUpdateState(_ central: CBCentralManager) {
        switch central.state {
        case .unknown:
            print("central.state is .unknown")
        case .resetting:
            print("central.state is .resetting")
        case .unsupported:
            print("central.state is .unsupported")
        case .unauthorized:
            print("central.state is .unauthorized")
        case .poweredOff:
            print("central.state is .poweredOff")
        case .poweredOn:
            print("central.state is .poweredOn")
            centralManager.scanForPeripherals(withServices: nil)
        @unknown default:
            fatalError()
        }
    }

    func centralManager(_ central: CBCentralManager, didDiscover     peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI:     NSNumber) {
        print("RIZK:Peripheral---",peripheral)

    }

}

我的问题是,有没有人知道除了从特定应用程序之外,是否还有其他方法不能使用打印机?

任何人都可以帮助连接此打印机吗?

0 个答案:

没有答案