自定义电容器插件因 pod 依赖性而失败

Custom capacitor plugin fails with pod dependency

我正在基于

编写自己的电容器插件

https://capacitorjs.com/docs/ios/custom-code https://devdactic.com/build-capacitor-plugin/

但使用

将其添加到我的主项目中
npm install ../MyPlugin

失败

npx cap sync

✖ Updating iOS native dependencies with "pod install" (may take several minutes): 
✖ update ios: 
[error] Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "MyPlugin":
  In Podfile:
    MyPlugin (from `../../../my-plugin`)

Specs satisfying the `MyPlugin (from `../../../my-plugin`)` dependency were found, but they required a higher minimum deployment target.

我尝试调整所需的 podfile ios 版本,如 `Firebase/Auth` dependency were found, but they required a higher minimum deployment target

到11要配合我的主项目

platform :ios, '11.0'

def capacitor_pods
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  pod 'Capacitor', :path => '../node_modules/@capacitor/ios'
  pod 'CapacitorCordova', :path => '../node_modules/@capacitor/ios'
end

target 'Plugin' do
  capacitor_pods
end

target 'PluginTests' do
  capacitor_pods
end

但错误仍然存​​在。我应该去哪里寻找它? 谢谢

您应该查看的指南是 this one

或者 this one 如果你在电容器 2 中。

如果您将应用程序从 Capacitor 2 迁移到 Capacitor 3,您可能错过了 step 必须将部署目标更改为 iOS 12

Capacitor 3 要求您的应用将 iOS 12 作为部署目标,如果您按照第一个 link 上的指南进行操作,该插件也将需要 iOS 12。而如果你在电容器 2 中并跟随第二个 link,则插件将需要 iOS 11.