[英]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文件等時會引發錯誤。
可可粉:1.5.3
當您在Podspec中指定依賴項時,就是說您的自定義框架依賴於它們。 因此,依賴關系只能在您的框架內引用。 如果您希望示例應用程序能夠引用Firebase,則需要在示例應用程序的podfile中指定它。
文檔參考:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.