xcode error:no such file or directory prefix.pch

     如果要更改Info.plist与Prefix.pch文件实际路径,也就是实际文件的位置(不是在工程中的组织路径),需要到Build Settings中修改对应的配置,不然工程就找不到对应的Info.plist与Prefix.pch文件。

报错情况

1、Info.plist文件路径错误

error: could not read data from '/Users/sf_gxd/Desktop/Gasake/Gasake/Gasake-Info.plist': The file “Gasake-Info.plist” couldn’t be opened because there is no such file.
2、prefix.pch文件路径错误
clang: error: no such file or directory: '/Users/sf_gxd/Desktop/Gasake/Gasake/Gasake-Prefix.pch'
clang: error: no input files


解决方案:

1.如果项目是使用别人的,极有可能是没有正确配置,首先在find中查找Prefix.pch文件所在的真实物理路径(项目中的文件夹分组是虚拟的

   Info.plist文件路径错误,可使用1方法解决

 2.如果是自己的项目,出现这种错误,可能是忘记建立Prefix.pch文件

  1. Make new file: ⌘cmd+N
  2. iOS/Mac > Other > PCH File > ProjectName-Prefix.pch.
  3. Project > Build Settings > Search: "Prefix Header".
  4. Under "Apple LLVM 6.0" you will get the Prefix Header key.
  5. Type in: ProjectName/ProjectName-Prefix.pch
  6. Clean project: ⌘cmd+⇧shift+K
  7. Build project: ⌘cmd+B

最后在此处修改,设置为正确的路径,Clean一下,然后运行即可,如下所示:

3.最后一种解决方法,是一种伪方法,没有从本质上解决问题,但是有时确实可以解决错误

根据以上图片删除  XXX-Prefix.pch文件

i solved it - in targets delete xctest target and it compiled




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

薛瑄

文章不错,请博主吃包辣条

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值