如何在 Cordova 中更改部署目标

How to change deployment target in Cordova

我有一个插件需要高于 8.0 的部署目标。我可以更改我的 pod 文件,但 Cordova 总是将它改回来。有没有办法设置它?我试过了:

<preference name="deployment-target" value="10.0" />

在 config.xml.

我的问题是我总是在安装时得到这个:

结果是:

所以尽管

cordova plugin list 

显示添加的插件,它们实际上不在文件夹中。那里唯一的一个是 cordova-plugin-appcenter-shared 所以我从两个插件文件夹中删除了它并重新 运行

cordova plugin add cordova-plugin-appcenter-analytics 

一切都安装正确。

如果您收到 CocoaPods could not find compatible versions for pod "AppCenter" ... Specs satisfying the 'AppCenter (~> 1.13.2) dependency were found, but they required a higher minimum deployment target,您的目标可能是 iOS 小于 9,并且您的 Podfile 是使用指定的 AppCenter 版本生成的。

我相信 AppCenter 0.3.0 负责将 iOS Podfile 从 pod 'AppCenter' 更改为 pod 'AppCenter ~> 1.13.2'(或您的情况下为 1.12.0)

您可以尝试通过添加值为“9.0”的 Cordova config.xml 'deployment-target' 首选项来强制 Podfile 以 iOS 9 或更高版本为目标,但这在 cordova 上不起作用- ios 4.5.5+。否则,您必须手动更改 Podfile 或 Xcode 中的目标(都不推荐)。或者,您可以在短期内将 AppCenter SDK/plugins 降级到 0.2.2,这样 Podfile 就不会指定 AppCenter 版本。