我编写了一个小型库,可供多个 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
根目录仅包含规范和源目录,后者包含 .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 个虚拟文件。
如此处所示: