NoMethodError - nil:NilClass Cocoapods version 1.0 的未定义方法"路径"



这一行是我的podfile导致此问题的原因:

pod 'JiveCommon', :path => 'Common/JiveCommon'

在我的根目录中,有一个名为"Common"的文件,在一个项目名称JiveCommon witch中,它本身就是一个pod

我曾经在子模块中这样使用它,所以我可以更改和编辑当前项目上下文中的文件,但在升级到Cocoapods v 1.0后,我收到了以下错误:

### Error
```
NoMethodError - undefined method `path' for nil:NilClass
/Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.0.0/lib/xcodeproj/project/object/native_target.rb:442:in `block in add_file_references'
/Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.0.0/lib/xcodeproj/project/object/native_target.rb:441:in `map'
/Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.0.0/lib/xcodeproj/project/object/native_target.rb:441:in `add_file_references'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer/target_installer/pod_target_installer.rb:99:in `block in add_files_to_build_phases'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer/target_installer/pod_target_installer.rb:75:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer/target_installer/pod_target_installer.rb:75:in `add_files_to_build_phases'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer/target_installer/pod_target_installer.rb:21:in `block in install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/user_interface.rb:144:in `message'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer/target_installer/pod_target_installer.rb:17:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:621:in `block (2 levels) in install_libraries'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:619:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:619:in `block in install_libraries'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/user_interface.rb:144:in `message'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:618:in `install_libraries'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:170:in `block in generate_pods_project'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/user_interface.rb:63:in `section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:167:in `generate_pods_project'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:119:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/command/install.rb:37:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-1.0.0/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/command.rb:50:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
```

我看了一下纪录片,是否有使用"Path"语法的不同最佳实践,但没有发现任何东西。。

Githb问题也出现了同样的问题:https://github.com/CocoaPods/CocoaPods/issues/4814

但没有解决方案。

其他人也有同样的经历吗?

我已经设法解决了这个问题,如果其他人也会面临同样的问题,在子模块pod规范中,我需要更改:

更改源文件没有帮助。我有一个私人podspec,以前包含

s.source_files = 'Common/**/*
To
s.source_files = 'Common/**/*.{m,h,mm,hpp,cpp,c}'

最新更新