Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

override function get exception #39

Closed
MimikFc7 opened this issue Dec 17, 2019 · 7 comments
Closed

override function get exception #39

MimikFc7 opened this issue Dec 17, 2019 · 7 comments

Comments

@MimikFc7
Copy link

Hello, when i add override function from get wifi signal:

`func getWifiSignalStrength() {
self.device?.getWifiSignalStrength(success: {
print("get wifi signal strength success")
}, failure: { (error) in
if let e = error {
print("get wifi signal strength failure: (e)")
}
})
}

// MARK: - TuyaSmartDeviceDelegate
func device(_ device: TuyaSmartDevice!, signal: String!) {

}`

take exception :

unrecognized selector sent to instance 0xa777d538f873fb09
2019-12-17 22:37:03.890862+0300 HomeAlone[8529:2794962] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0xa777d538f873fb09'

delegate was added TuyaSmartDeviceDelegate

@TuyaRonbin
Copy link
Contributor

Can you provide a complete crash stack?

@MimikFc7
Copy link
Author

Can you provide a complete crash stack?

Hello, yes, i come back to home after a 8 hours and send.

@MimikFc7
Copy link
Author

2019-12-18 22:42:48.465149+0300 HomeAlone[998:190713] filter dps from lan 2019-12-18 22:42:48.465311+0300 HomeAlone[998:190713] -[__NSCFNumber length]: unrecognized selector sent to instance 0xb28e97f01270aa7c 2019-12-18 22:42:48.465563+0300 HomeAlone[998:190713] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0xb28e97f01270aa7c' *** First throw call stack: (0x185652a48 0x185379fa4 0x1855565a8 0x185656af4 0x185658a7c 0x192a540d0 0x192a54270 0x1bab8c0f4 0x1007cf9cc 0x10138df4c 0x1855ae288 0x1855ae2d0 0x1855ad630 0x1855ad2e8 0x18552959c 0x1855acc38 0x185909138 0x10096ec2c 0x1034957fc 0x103496bd8 0x1034a4c34 0x1855d05e4 0x1855cb5d8 0x1855caadc 0x18f550328 0x1896c5ae0 0x1008614fc 0x185454360) libc++abi.dylib: terminating with uncaught exception of type NSException

@MimikFc7
Copy link
Author

MimikFc7 commented Dec 18, 2019

so i found where that trouble!
in conversion type:

- (void)device:(TuyaSmartDevice *)device signal:(NSString *)signal

signal - it's a pointer, but in that pointer come NSNumber
in Swift types conversion very strong.

i make a simple class and override that!

`- (void)device:(TuyaSmartDevice *)device signal:(NSString *)signal{

if(self.delegate != nil){
    
    NSNumber *cater = signal;
    [self.delegate device:device signal: [NSString stringWithFormat:@"%ld",[cater longValue]]];
}

}`

and it's work!
please fix that!

@TuyaRonbin
Copy link
Contributor

We will fix the errors in the next version.
Sorry, I haven't tested swift before.

@MimikFc7
Copy link
Author

Yep, no problem, if you want, you can give me some codes for tested =)

JerryNil pushed a commit that referenced this issue Oct 9, 2020
feat: 手机号注册相关提示
@Zabihullahkayani
Copy link

        func getWifiSignalStrength() {
        self.device?.getWifiSignalStrength(success: {
            print("get wifi signal strength success")
        }, failure: { (error) in
            if let e = error {
                print("get wifi signal strength failure: \(e)")
            }
        })
    }
    
    // MARK: - TuyaSmartDeviceDelegate
    func device(_ device: TuyaSmartDevice!, signal: String!) {
    
    }

I am using this function from Tuya docs for iOS, my problem is my delegate method never call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants