Swift (iOS) Plugin - Method not defined in Plugin Error - Cordova Swift (iOS) Plugin - Method not defined in Plugin Error - Cordova objective-c objective-c

Swift (iOS) Plugin - Method not defined in Plugin Error - Cordova


Adding the _ before the parameter was not enough for me. I had to add a @objc(test:) before the method as well.

@objc(test:)func test(_ command: CDVInvokedUrlCommand) {    // whatever}


My example was as following, without _ it was not working!!Notice: This solution is a fix for Swift 3

@objc(LibCDVP) class LibCDVP : CDVPlugin {    func echo(_ command: CDVInvokedUrlCommand) {        print("method call OK!")        let msg = command.arguments[0] as? String ?? ""        let pluginResult = CDVPluginResult(            status: CDVCommandStatus_OK,            messageAs: msg + ",ECHO"        )        self.commandDelegate!.send(            pluginResult,            callbackId: command.callbackId        )    }}


Dan, was right, I just added _ before the parameters.

Thanks.