Получение ошибки в MTPasswordRequireBlock

Я использую фреймворки beaconplus, zip и dfu и получаю эту ошибку.

Невозможно преобразовать значение типа '((String?) -> Void) -> Void "в ожидаемый тип аргумента" MTPasswordRequireBlock! " (aka 'ImplicitlyUnwrappedOptional<(Необязательно <(Необязательно) -> ()>) -> ()>')

Мой код:

 @IBAction func connect(_ sender:UIButton) {
    /*
     manager: a MTCentralManager sharedInstance
     aMTPeripheral: a MTPeripheral instance
     */
    // listen the change of device connection state

    aMTPeripheral.connector.statusChangedHandler = {(_ status: ConnectionStatus,_ error:Error?) -> Void in


    }
    // Connect to the device
    // the aMTPeripheral is a device instance
    // !!!:Warnning: passwordRequire must not be NULL!!!

    // getting error in this line:

    manager.connect(toPeriperal: aMTPeripheral, passwordRequire: {(_ passwordBlock: MTPasswordBlock) -> Void in
        // the length of password string must be 8.
        // !!! read the input content from the UITextField as a password in development.
        var password = "minew123"
        passwordBlock(password)
    })
    // disconnec from the device.
    manager.disconnect(fromPeriperal: aMTPeripheral)
}

0 ответов

Другие вопросы по тегам