Custom Capacitor 6 plugin with SPM: "plugin is not implemented on ios" despite being compiled #8402
-
|
Category: StoreKit / In-App Purchase Hi everyone, I'm building an iOS app using Capacitor 6 with Swift Package Manager (SPM). I have a custom native plugin (AppleIAPPlugin) for StoreKit 2 In-App Purchases that lives in the App target (not as an SPM package). Despite compiling successfully, the JavaScript bridge throws: "AppleIAP" plugin is not implemented on ios Setup swift @objc(AppleIAPPlugin) } objc CAP_PLUGIN(AppleIAPPlugin, "AppleIAP", swift class MyBridgeViewController: CAPBridgeViewController { TypeScript side: typescript Is there a step I'm missing to make registerPluginType() work, or should I structure my custom plugin as a local SPM package instead? Any guidance would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You have to use https://capacitorjs.com/docs/v6/ios/custom-code#register-the-plugin Also, you shouldn't be using the .m file anymore, the methods should be declared in the own .swift file and the plugin class should be a https://capacitorjs.com/docs/v6/ios/custom-code#echopluginswift |
Beta Was this translation helpful? Give feedback.
You have to use
registerPluginInstance, notregisterPluginType.https://capacitorjs.com/docs/v6/ios/custom-code#register-the-plugin
Also, you shouldn't be using the .m file anymore, the methods should be declared in the own .swift file and the plugin class should be a
CAPBridgedPlugininstance. And the class should include aidentifierandjsName.That is also explained on the same page, different section
https://capacitorjs.com/docs/v6/ios/custom-code#echopluginswift