簡體   English   中英

無法在自定義框架中添加cocoapod依賴性-Swift

[英]Unable to add cocoapod dependancy in Custom framework - Swift

報告

你做了什么?

我為自定義框架創建了podspec文件,如下所示:

Pod::Spec.new do |s|
  s.platform = :ios
  s.ios.deployment_target = '10.0'
  s.name = "CustomFramework"
  s.summary = "CustomFramework have all the wrapper API."
  s.requires_arc = true
  s.version = "1.0.0"
  s.license = { :type => "MIT", :file => "LICENSE" }
  s.author = { "My Name" => "my.name@xyz.com" }
  s.homepage = "URL_LINK"
  s.source = { :git => "github_url_link", :tag => "#{s.version}"}

      s.dependency 'RealmSwift', '3.5.0'
      s.dependency 'Firebase/Core', '5.1.0'
      s.dependency 'Firebase/Firestore', '5.1.0'
      s.dependency 'PubNub','4.7.5'

  s.source_files = "CustomFramework/**/*.{swift}"
end

我在示例項目中將此自定義框架pod添加為:

target 'customFrameworkSample' do
  use_frameworks!
  pod 'customFramework' , :path => 'Local_Path_for_customFramework.podspec'

  target 'customFrameworkSampleTests' do
    use_frameworks!
      pod 'customFramework' , :path => 'Local_Path_for_customFramework.podspec'
  end
end

您期望發生什么?

Pod應該正確安裝,並且當示例項目為Build時,它應該運行並且不會引發任何錯誤。

發生了什么事?

在Sample項目中,在CustomFramework文件中導入firbase,RealmSwift文件等時會引發錯誤。 屏幕截圖於2018年3月22日下午3點24分

CocoaPods環境

可可粉:1.5.3

當您在Podspec中指定依賴項時,就是說您的自定義框架依賴於它們。 因此,依賴關系只能在您的框架內引用。 如果您希望示例應用程序能夠引用Firebase,則需要在示例應用程序的podfile中指定它。

文檔參考:

Podspec的“依賴關系”

Podfile'dependancies'

確保已在鏈接框架和庫中添加了Firebase庫

在此處輸入圖片說明

暫無
暫無

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

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