簡體   English   中英

將Pod依賴項添加到cordova插件

[英]Add Pod dependency to a cordova plugin

我目前正在構建一個Ionic 3項目,我需要開發一個自定義的Cordova插件,該插件需要一個適用於iOS平台的Pod( https://github.com/NordicSemiconductor/IOS-Pods-DFU-Library )。

我加了線

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

到plugin.xml文件的子元素

<platform name="ios">

它似乎沒有安裝Pod依賴關系。 然后創建podfile,將所需的pod添加到podfile

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

最后fin運行pod安裝。 我修復了Xcode的一些依賴性問題(對於嵌入式庫和運行路徑,使用$(繼承))

然后我跑

ionic cordova build ios

從根目錄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編寫的自定義插件?

第二個問題 :ProcessProductPackaging是什么意思?

文獻資料

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

如何將Cocoapod依賴項與Cordova插件捆綁在一起?

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

任何建議表示贊賞

查看此文檔

科爾多瓦規格

與type =“ podspec”配對,這是您要安裝的CocoaPod的規范字符串(僅靜態庫)。 CocoaPod支持僅在cordova-ios 4.3.0和cordova-cli 6.4.0中存在。 對於您的插件,請確保添加適當的標簽和package.json依賴項,以確保向后兼容。

將此添加到您的plugin.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>

和你的package.json文件

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

1.0.0應該是您的cordova插件版本。

最后也是最重要的一點是,請確保您全局更新為node和cordova的最新版本。

還將您的IOS項目更新為最低支持版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM