I’m building an Capacitor Plugin. To autenticate a user using WebAuthn (since this is not yet suported in WKWebView-based browsers)
Within this plugin I’m using WebAuthnKit I added it to my Podfile
of my plugin. Like so:
...
use_frameworks!
pod 'Capacitor', :path => '../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../node_modules/@capacitor/ios'
pod 'WebAuthnKit', '~> 0.9.5'
...
After running pod install
it works great! Also when I build only my plugin using xcode it builds successfully
But then when I use my plugin in my ionic capacitor app (installed locally via npm) xcode spits out the error
No such module 'WebAuthnKit'
on the line in the plugin code where I do import WebAuthnKit
to use it.
I can fix it by hand but after running ionic cap sync ios
all my changes are gone!
What I do to fix it:
- Also add
pod 'WebAuthnKit', '~> 0.9.5'
to my ionic app podfile - Also run
pod install
in theios/App
folder of my ionic app - Select
Pods project
from xcode - Select
CapacitorMyPlugin
from thetargets
panel to select my plugin - Add
WebAuthnKit
to the list ofLink Binary With Libraries
underBuild Phases
- Add
"${PODS_CONFIGURATION_BUILD_DIR}/WebAuthnKit"
in theFramework Search Paths
(debug and release) underBuild Settings
After this is done the error is gone but I have to repeat these steps after every ionic cap sync ios
.
Has anyone used external Kits in a Capacitor Plugin?
How do you link the correct pods from xcode workspace?
(opening .xcodeproj
or .xcworkspace
makes no difference only when opening .xcodeproj
it sais No such module ‘Capacitor’)