本地CocoaPod规格失败

时间:2013-11-04 21:56:18

标签: ios ruby xcode cocoapods

我写了一个小型库,将被多个iOS应用程序使用。

我已经根据我的知识配置了规范,并想象它应该可以工作,但事实并非如此。

以下是规范:

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 

root只包含spec和Source dir,后者包含.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

但是,阅读GitHub页面上的3个帖子不会产生任何答案。这就好像没有添加源或其他东西(NilClass?)。

当我在使用该库的项目目录中运行pod install时,使用此podfile:

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

并打开工作区,Xcode正确安装了所有deps,但有一个名为“Development Pods”的目录,其中包含一个“TheLib”目录,它只有4个虚拟文件。

如下所示:

Dev Pods

1 个答案:

答案 0 :(得分:0)

默认情况下,

pod spec lint的工作方式是从远程源下载代码,而不是使用本地项目。

您发布的回溯显示异常是在方法install_source_of_pod中引发的,后者随后调用download_source - 这将尝试从远程源下载项目,这是因为失败,因为您尚未指定提供规范的source属性。

提供a valid source attribute应解决此特定错误。