CocoaPods 报错


weifansdeMacBook-Pro:CocoaPodsTest weifans$ pod install
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.34.4/lib/cocoapods/user_interface/error_report.rb:13:in report': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError) from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.34.4/lib/cocoapods/command.rb:63:in report_error'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:300:in handle_exception' from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:274:in rescue in run'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:264:in run' from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.34.4/lib/cocoapods/command.rb:50:in run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.34.4/bin/pod:33:in <top (required)>' from /usr/bin/pod:23:in load'
from /usr/bin/pod:23:in `'
weifansdeMacBook-Pro:CocoaPodsTest weifans$

好多方法都试过了不管用

Ruby Version:
weifansdeMacBook-Pro:CocoaPodsTest weifans$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]

CocoaPods Version:
weifansdeMacBook-Pro:CocoaPodsTest weifans$ pod --version
0.34.4

求大神:ˊ_>ˋ

ios cocoapods

薛定谔D黑猫 10 years, 1 month ago

看了一下题主的Podfile,是老的写法,cocoapods 0.34以后换新的写法了:


 # platform :ios, '7.0'

target "Apptarget" do
    pod "Reachability", "~> 3.0.0"
    pod "SBJson", "~> 4.0.0"
    pod "AFNetworking', '~> 2.0"
end

用上面这个新的写法试一试吧,其中引号里的Apptarget请替换成你的App编译的那个target,一般就是你建立App工程的名称(其单元测试target,就是在这个后面多了Tests这个后缀,注意不要搞错)。


更新

之前的代码里面加了一句 source 'master' , Cocoapods 0.34正式版以后source指令用来建立自己的podspec库,如果不希望把自己的代码注册为一个podspec,可以不用这个指令。但是隐式源已经被deprecate掉了,所以为了兼容以后的cocoapods版本,需要在前面加上 source 'https://github.com/CocoaPods/Specs.git' 。这个repo是Cocoapods官方维护的Spec repo。

loli孀 answered 10 years, 1 month ago

Your Answer