iOS pch文件创建使用,和info.plis文件路径改变,路径的设置

一 路径报错;

二 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 

解决方案:

将路径 按照自己工程 修改正确,Clean一下,然后运行即可。 

修改如下所示

二: 

首先.我们创建一个PrefixHeader.pch

 新建文件-ios-other


 
 

      然后将这个prefix文件和这个工程关联,

 

    在Build Settings 中搜索Prefix    在工程中右键pch-show in finder,(直接将这个文件拖进去就行);


 

这样修改的路径只能在这台电脑上编译通过,想要在其他电脑上编译通过需要将第一遍工程名之前的路径替换成工程的相对路径$(SRCROOT)

也就是将:

/Users/XSY/Desktop/XS/PrefixHeader.pch

修改为

$(SRCROOT)/PrefixHeader.pch

回车进行编译

 
原文地址:https://www.cnblogs.com/xujiahui/p/6076658.html