问题描述
项目用到cocoapods管理第三方框架,所以需要打开xxxx.xcworkspace,Pods正常显示,但xxxx.xcodeproj显示红色,不包含xxxx.xcodeproj并且无法操作。
尝试把Podfile、Podfile.lock、xxxx.xcworkspace和Pods文件夹全部删除。

然后打开xxxx.xcodeproj,打开Podfile文件

编辑Podfile文件

执行安装相应的第三方类库

但出现错误[!] Attempt to read non existent folder

开始以为cocoapods问题,又尝试重装cocoapods。
网上说要执行下面的命令
sudo -- sh -c "echo '117.18.237.29 ocsp.digicert.com' >> /etc/hosts
但问题还是没解决,真是让人抓狂!!!!!
问题分析
找了很久,终于发现问题。其实问题不在cocoapods,安装相应的第三方类库也没问题。刚开始就应该向工作区间xxxx.xcworkspace不包含xxxx.xcodeproj 的问题解决,既然不包含,可能原因是xxxx.xcworkspace里描述xxxx.xcodeproj的路径错误,或者xxxx.xcodeproj本身的路径错误。我猜想应该是前者的问题。
打开xxxx.xcworkspace,点击xxxx.xcodeproj发现路径真的和我xxxx.xcodeproj所在的路径不一样。
问题解决
打开xxxx.xcworkspace,点击xxxx.xcodeproj

然后点击右侧界面,点击Location下方的文件夹图标修改路径,选择正确的xxxx.xcodeproj文件。

保存路径,xxxx.xcodeproj被包含,运行程序也正常了。

注意
要选择正确的项目运行,不然无法运行


网友评论