ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
11.24k stars 955 forks source link

[Bug]: Error: "IDnow" plugin is not implemented on ios #7428

Closed mrsamse closed 3 weeks ago

mrsamse commented 3 weeks ago

Capacitor Version

Latest Dependencies:

@capacitor/cli: 6.0.0 @capacitor/core: 6.0.0 @capacitor/android: 6.0.0 @capacitor/ios: 6.0.0

Installed Dependencies:

@capacitor/cli: 6.0.0 @capacitor/core: 6.0.0 @capacitor/android: 6.0.0 @capacitor/ios: 6.0.0

[success] iOS looking great! 👌 [success] Android looking great! 👌

Other API Details

No response

Platforms Affected

Current Behavior

I have implemented my own plugin for capacitor, which I only use in a single app. So the plugin is integrated in the app itself and is not installed via npm.

After upgrading from capactior 5 to 6 I get now this error message in the logs: Error: "IDnow" plugin is not implemented on ios

(IDnow is the name of my plugin)

I didn't change anything in the plugin code and the plugin works fine on android. And If I switch back to capacitor 5, the plugin works fine again.

Has anything changed for custom plugins on iOS?

Expected Behavior

My plugin should work with capactior 5 and 6 without changing the plugin code.

Project Reproduction

Question without reproduction

Additional Information

Content of IDnowPlugin.m:

#import <Foundation/Foundation.h>
#import <Capacitor/Capacitor.h>

CAP_PLUGIN(IDnowPlugin, "IDnow",
  CAP_PLUGIN_METHOD(startIdent, CAPPluginReturnPromise);
)

Content of IDnowPlugin.swift:

import Foundation
import Capacitor
import IDNowSDKCore

@objc(IDnowPlugin)
public class IDnowPlugin: CAPPlugin {

    @objc public func startIdent(_ call: CAPPluginCall) {
        let ident: String = call.getString("ident") ?? ""
        let language: String = call.getString("language") ?? ""
        let controller: UIViewController = self.bridge!.viewController!

        IDNowSDK.shared.start(token: ident, preferredLanguage: language, fromViewController: controller, listener:{(result: IDNowSDK.IdentResult.type, statusCode: IDNowSDK.IdentResult.statusCode, message: String) in
            if result == .ERROR {
                call.reject("Error", String(statusCode.rawValue))
            } else if result == .CANCELLED {
                call.reject("Cancelled", String(statusCode.rawValue))
            } else if result == .FINISHED {
                call.resolve()
            }
        })

    }
}

I followed those 2 guides for the plugin implementation: https://capacitorjs.com/docs/ios/custom-code https://capacitorjs.com/docs/plugins/tutorial/ios-implementation

jcesarmobile commented 3 weeks ago

duplicate of https://github.com/ionic-team/capacitor-docs/issues/275