git和cocapods 遇到的问题 总结

使用cocoaPods 时候总是遇到很坑的问题,总结下

---世上无难事只怕有心人---

(原创内容,转载请注明出处)

1.卡在Updating local specs repositories

pod install 被墙了,请大家换成

pod install --verbose --no-repo-update

2.出现这种警告

Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.

解决办法:
不要使用文本编辑去编辑Podfile,使用Xcode编辑,或者使用终端敲命令去编辑。或者输入格式错误,没输入运行版本:$platform:ios, '9.0'

3.使用cocoapods导入第三方类库后头文件没有代码提示?

解决办法:
选择Target -> Build Settings 菜单,找到"User Header Search Paths"设置项,新增一个值"${SRCROOT}",并且选择"Recursive"


git和cocapods 遇到的问题 总结_第1张图片
cocoaPods_problems1.png

4.项目运行时报错

Thefile “Pods.xcconfig” couldn’t be opened because there is no such file.

解决方法:pod update 就可以了

5.项目运行时报错: the sandbox is not in sync with the Podfile.lock

解决办法:关闭当前的工作空间,删除掉根目录中的workSpace,然后重新安装pod install,然后在双击代开项目中project.xcworkspace,执行clean后bulid

或者,删除项目中Podfile.lock中的文件,再次pod install运行项目
(导致原因,由于vim podfile文件中没有指定第三方具体项目版本,所以导致出现lock)

6.终端报错:

-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

解决办法:在终端中输入:

sudo gem install -n /usr/local/bin cocoapods

即可解决

7.使用cocoapods 时 搜索不到最新的第三方库

一般可能是缓存的问题,
解决办法:更新本地的缓存
pod repo update
但有时候,更新还是不起作用

pod cache clean --all
rm -rf ~/Library/Caches/CocoaPods
Pod repo update

8.在coding申请账号网页新建项目后,在Xcode新建git remote后,推送到远程仓库出现报错,产生原因是远程仓库和本地仓库并不一致所造成,网页新建项目存在readme.md导致冲突

报错:error:failed to push some refs to ‘git@git...’
解决办法:先pull后push

git pull origin master --allow--unrelated-histories

git push -u origin master

持续更新

你可能感兴趣的:(git和cocapods 遇到的问题 总结)