2013-11-04 91 views
2

我寫了一個小型庫,將被多個iOS應用程序使用。本地CocoaPod規格失敗

我已經根據我的知識配置了規範,並且想象它應該可以工作,但事實並非如此。

這裏是規格:

Pod::Spec.new do |s|                                  
    s.name     = 'TheLib'                             
    s.version    = '1.0.0'                              
    s.ios.deployment_target = '5.0'                              
    s.source_files   = 'Source/**/*.{h,m}'                           
    s.resources    = 'Source/View/Storyboard/*.storyboard'                      
    s.dependency  'AFNetworking', '~> 1.3.3'                           
    s.dependency  'SDWebImage', '~> 3.5'                            
    s.dependency  'FrameAccessor', '~> 1.2.0'                           
    s.dependency  'NSDate+TimeAgo', '~> 1.0.2'                           
end 

根簡單地容納所述規範和源文件目錄,其中包含的.h &的.m的顯示目錄後者。

當我運行pod spec lint,我得到:

――― MARKDOWN TEMPLATE ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 

### Report 

* What did you do? 

* What did you expect to happen? 

* What happened instead? 


### Stack 

``` 
    CocoaPods : 0.26.2 
     Ruby : ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin13.0] 
    RubyGems : 2.0.3 
     Host : Mac OS X 10.9 (13A603) 
     Xcode : 5.0.1 (5A2053) 
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib 
Repositories : master - https://github.com/CocoaPods/Specs.git @ 50abc95a6583527b26b4f80c0a1e4e77052511ba 
``` 

### Error 

``` 
TypeError - can't dup NilClass 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer/pod_source_installer.rb:149:in `dup' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer/pod_source_installer.rb:149:in `downloader' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer/pod_source_installer.rb:101:in `download_source' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer/pod_source_installer.rb:64:in `install!' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer.rb:263:in `install_source_of_pod' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer.rb:237:in `install_pod_sources' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/user_interface.rb:73:in `titled_section' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer.rb:236:in `install_pod_sources' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer.rb:234:in `each' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer.rb:234:in `install_pod_sources' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer.rb:103:in `download_dependencies' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/user_interface.rb:52:in `section' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer.rb:101:in `download_dependencies' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/installer.rb:87:in `install!' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/validator.rb:209:in `install_pod' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/validator.rb:177:in `perform_extensive_analysis' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/validator.rb:173:in `each' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/validator.rb:173:in `perform_extensive_analysis' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/validator.rb:63:in `validate' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/command/spec.rb:83:in `run' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/command/spec.rb:78:in `each' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/command/spec.rb:78:in `run' 
/Library/Ruby/Gems/1.8/gems/claide-0.3.2/lib/claide/command.rb:206:in `run' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/lib/cocoapods/command.rb:51:in `run' 
/Library/Ruby/Gems/1.8/gems/cocoapods-0.26.2/bin/pod:19 
/usr/bin/pod:23:in `load' 
/usr/bin/pod:23 
``` 

――― TEMPLATE END ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 

[!] Oh no, an error occurred. 

Search for existing github issues similar to yours: 
https://github.com/CocoaPods/CocoaPods/search?q=can%27t+dup+NilClass&type=Issues 

但是,讀3個職位上GitHub的頁數沒有答案。就好像源代碼沒有被添加或者什麼(NilClass?)。

當我在使用該庫項目目錄運行pod install,這個podfile:

pod 'TheLib', :path => '../TheLib' 

,並打開工作區時,Xcode擁有所有正確安裝DEPS的,但有一個名爲「發展莢目錄「,其中包含一個」TheLib「目錄,它只有4個虛擬文件。

正如在這裏看到:

Dev Pods

回答

0

pod spec lint默認的工作原理是從遠程源下載的代碼,而不是使用本地項目。

您發佈的回溯顯示,異常的方法install_source_of_pod,隨後調用download_source - 這是因爲你尚未指定提供將試圖從遠程數據源,這是失敗的下載項目被拋出您的規格的source屬性。

提供a valid source attribute應該修復這個特定的錯誤。