将POD依赖性添加到Cordova插件



我目前正在构建一个离子3项目,我需要开发一个自定义的cordova插件,该插件需要iOS平台的POD(https://github.com/nordicsemictemendoctor/ios-ios-ios-ios-pods-dfu-library)。

我添加了行

<framework src="iOSDFULibrary" type="podspec" spec="4.1.0"/>

to plugin.xml文件,

的子元素
<platform name="ios">

它似乎没有安装POD量。然后创建了Podfile,将所需的POD添加到Podfile

target 'MyApp' do
    use_frameworks!
    pod 'iOSDFULibrary'
end

最后,Fin Run Pod安装。我修复了Xcode(使用$(继承)嵌入式库和RunPath的一些依赖关系)

然后我运行

ionic cordova build ios

从root Directoy中,我得到以下错误:

 ProcessProductPackaging "" /Users/XXX/Library/Developer/Xcode/DerivedData/MyApp-cnmgcjqxsbizwzgzyunkhpaidafn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Zip.build/Zip.framework.xcent
cd /Users/XXX/Documents/dev/app/test/ble/ble/last/platforms/ios/Pods
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/XXX/Documents/dev/app/test/ble/ble/last/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/Cellar/android-sdk/24.1.2/tools:/usr/local/Cellar/android-sdk/24.1.2/platform-tools≈"
builtin-productPackagingUtility -entitlements -format xml -o /Users/XXX/Library/Developer/Xcode/DerivedData/MyApp-cnmgcjqxsbizwzgzyunkhpaidafn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Zip.build/Zip.framework.xcent
 warning: Falling back to contents of entitlements file "Entitlements-Debug.plist" because it was modified during the build process. Modifying the entitlements file during the build is unsupported.error: The file “Entitlements-Debug.plist” couldn’t be opened because there is no such file.
 === BUILD TARGET CordovaLib OF PROJECT CordovaLib WITH CONFIGURATION Debug ===
 Check dependencies
 Write auxiliary files
 /bin/mkdir -p /Users/XXX/Documents/dev/app/test/ble/ble/last/platforms/ios/build/sharedpch/CordovaLib_Prefix-asuvblhsjpogpaeowyccynwoocft
 write-file /Users/XXX/Documents/dev/app/test/ble/ble/last/platforms/ios/build/sharedpch/CordovaLib_Prefix-asuvblhsjpogpaeowyccynwoocft/CordovaLib_Prefix.pch.pch.hash-criteria
 write-file /Users/XXX/Library/Developer/Xcode/DerivedData/MyApp-cnmgcjqxsbizwzgzyunkhpaidafn/Build/Intermediates.noindex/CordovaLib.build/all-product-headers.yaml
 ** BUILD FAILED **

 The following build commands failed:
 ProcessProductPackaging ""      /Users/XXX/Library/Developer/Xcode/DerivedData/MyApp-cnmgcjqxsbizwzgzyunkhpaidafn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Zip.build/Zip.framework.xcent
 (1 failure)
 Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/XXX/Documents/dev/app/test/ble/ble/last/platforms/ios/cordova/build-debug.xcconfig,-workspace,MyApp.xcworkspace,-scheme,MyApp,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone SE,build,CONFIGURATION_BUILD_DIR=/Users/XXX/Documents/dev/app/test/ble/ble/last/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/XXX/Documents/dev/app/test/ble/ble/last/platforms/ios/build/sharedpch

第一个问题:如何捆绑用Swift编写的Cocoapod到用Swift编写的自定义插件?

第二个问题:ProcessProductAckaging的含义是什么?

文档

https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html

如何用Cordova插件将Cocoapod依赖性捆绑在一起?

https://github.com/blakgeek/cordova-plugin-cocoapods-support

任何建议都赞赏

查看此文档

科尔多瓦规格

与type =" podspec"配对,这是您要安装的可可录(仅静态库)的规格字符串。Cocoapod支持仅存在于Cordova-ios 4.3.0和Cordova-CLI 6.4.0中。对于您的插件,请确保添加适当的标签和软件包。JSON依赖项以确保向后兼容的支持。

将其添加到您的插件.xml

<engines>
    <engine name="cordova" version=">=7.0.0" />
    <engine name="cordova-android" version=">=6.3.0" />
    <engine name="cordova-ios" version=">=4.4.0" />
</engines>

和您的软件包.json文件

  "engines": {
  "cordovaDependencies": {
      "1.0.0": { 
        "cordova-ios": ">=4.4.0",
        "cordova-android": ">6.3.0",
        "cordova": ">=7.0.0"
      }
  }
},

1.0.0应该是您的Cordova插件。

最后,最重要的是,请确保您更新到全球最新版本和Cordova。

还将您的iOS项目更新为最低支持版本。

最新更新