idoosmart / IDOBlueDemo

ido bluetooth demo
8 stars 4 forks source link

Crash when trying to bind with bracelet #4

Closed zainanjum100 closed 3 years ago

zainanjum100 commented 3 years ago

Crash Message

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[IDOFoundationCommand bindingCommand:waitForSure:callback:]: unrecognized selector sent to class 0x102132098'
terminating with uncaught exception of type NSException

Code

let model = IDOSetBindingInfoBluetoothModel.init();
        IDOFoundationCommand.bindingCommand(model, waitForSure: {}, callback: {(state,errorCode) in
            if errorCode == 0 {
                if state == IDO_BIND_STATUS.BLUETOOTH_BIND_SUCCESS { //bind success
                    DispatchQueue.main.asyncAfter(deadline: .now() + 2.5) {
                       print(model)
                    }
                }else if state == IDO_BIND_STATUS.BLUETOOTH_BINDED { // binded

                }else if state == IDO_BIND_STATUS.BLUETOOTH_BIND_FAILED { // bind failed

                }else if state == IDO_BIND_STATUS.BLUETOOTH_NEED_AUTH { // bind need auth

                }else if state == IDO_BIND_STATUS.BLUETOOTH_REFUSED_BINDED { // bind refused

                }
            }else {
                print("device bind failed");
            }
        })