2017-01-23 64 views
0

我正在創建一個專用窗格來處理我的項目中使用的所有常見代碼。這個私人吊艙在他的podspec有幾個子配置,其中一個取決於一個衆所周知的公共吊艙:AFNetworking。無法找到[PRIVATE POD]依賴的[PUBLIC POD]的規範

在我podspec我有這個

Pod::Spec.new do |s| 
    s.name   = "NAME" 
    s.version  = "0.0.1" 
    s.summary  = "SUMMARY" 
    s.description = "DESCRIPTION" 
    s.homepage  = "https://myhomepage.com" 
    s.license  = { :type => "MIT", :file => "LICENSE" } 
    s.author  = { "Me" => "[email protected]" } 
    s.platform  = :ios, "8.0" 
    s.source  = { :git => "https://repositorywithmyprivatepodcode", :tag => s.version } 

    s.subspec 'Core' do |cs| 
    cs.source_files = "Source/Core/**/*.{h,m}" 
    end 

    s.subspec 'Resized' do |rs| 
    rs.source_files = "Source/Resized/**/*.{h,m}" 
    rs.dependency 'NAME/Core' 
    rs.dependency 'AFNetworking' , '~> 3.0' 
    end 

    s.subspec 'UI' do |us| 
    us.source_files = "Source/UI/**/*.{h,m}" 
    end 
end 

我對項目的Podfile在那裏我試圖用 「調整大小」 subspec

source 'https://repositorywithmyprivatepodcode' 

target 'TestProject' do 
    pod 'Square1/Resized' 
end 

但我這個代碼m運行時出現此錯誤pod install

[!] Unable to find a specification for `AFNetworking` depended upon by `Square1/Resized` 

我在這裏失蹤了什麼?

+0

'rs.dependency'和依賴項之間是否存在'='? – Larme

+0

不,不需要那個'=',正如你在這裏可以看到的那樣https://guides.cocoapods.org/making/specs-and-specs-repo.html – WedgeSparda

回答

0

嗯,我的問題是我沒有在我的項目的Podfile中包含Cocoapods主存儲庫。

官方的CocoaPods源代碼是隱含的。一旦你指定了另一個 源,那麼它將需要包括在內。

所以我改變了我的Podfile包括它

source 'https://bitbucket.org/square1mobileteam/square1-specs' 
source 'https://github.com/CocoaPods/Specs.git' 

和它的作品。

+0

可能它已被固定位顯式地給出你的私人莢的源代碼是否被解密並且保留默認的CocoaPods源代碼:'pod'Square1/Resized',::git =>'https:// repositorywithmyprivatepodcode''? – Larme

+0

不,cocoapods不允許在subspec中設置源。如果您嘗試執行'pod repo lint'後會發現錯誤。 – WedgeSparda