簡體   English   中英

如何將 cocoapod 框架使用到本地創建的另一個 cocoapod 中?

[英]How can you use cocoapod framework into another cocoapod created locally?

具體來說:

  1. 創建了一個新項目
  2. 設置 CocoaPods

  3. 對於 Pods 下的 Pod 文件,我添加了一個依賴項(例如 AlamoFire)

  4. 消耗 Pod 的主應用程序可以導入 Alamofire
  5. 我在 podfile 中使用以下幾行創建和添加的本地 cocoapod:

    target 'SomeValue' do my_own_pod pod 'CocoaPod_2', :path => '/LocalPath/To/PodSource' end

  6. Ran pod install 我將 AlamoFire 框架添加到 CocoaPod_2 下的 Pods -> General-> CocoaPod_2-> Linked Libraries & Binaries

  7. 在這一點上,我期待在我的 CocoaPod_2 中導入 Alamofire 會正常工作,但它不會。

工作區截圖:

MyProject.XCWorkspace |_MyProject.App |____Source Code files importing CocoaPod_1 (Embedded using CocoaPod) |____Source Code files importing CocoaPod_2 (Embedded using CocoaPods, local Pod) |_Pods |____Podfile |____Frameworks |____Pods |___CocoaPod_1 |___CocoaPod_1 Source Files |____Source Code for Local Pod |___CocoaPod_2 |____File contains statement (import cocoapod_1) <---Gives error ld: framework not found

您需要做以下兩件額外的事情:

  • 您需要在 CocoaPod_2 中添加一個 Podfile,然后進行pod install

  • 此外,您需要在 CocoaPod_2 文件夾中定義一個 CocoaPod_2.podspec 文件。

如果在Alamofire的 Podfile 和 podspec 文件中都添加了 Alamofire,則不需要在主應用的 Podfile 中添加。 只需在應用程序的 Podfile 中添加 CocoaPod_2 條目就足夠了。

我希望這有幫助!

暫無
暫無

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

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