如果要更改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文件
- Make new file: ⌘cmd+N
- iOS/Mac > Other > PCH File > ProjectName-Prefix.pch.
- Project > Build Settings > Search: "Prefix Header".
- Under "Apple LLVM 6.0" you will get the Prefix Header key.
- Type in:
ProjectName/ProjectName-Prefix.pch
- Clean project: ⌘cmd+⇧shift+K
- Build project: ⌘cmd+B
最后在此处修改,设置为正确的路径,Clean一下,然后运行即可,如下所示:
3.最后一种解决方法,是一种伪方法,没有从本质上解决问题,但是有时确实可以解决错误
根据以上图片删除 XXX-Prefix.pch文件
i solved it - in targets delete xctest target and it compiled