.xcconfig file in XCode

1.When you can use a .xcconfig file?
Use .xcconfig files if you find yourself changing the same build settings for each project you create. 
Place the build settings you're changing in the .xcconfig file. 
By using a .xcconfig file you can avoid editing those build settings every time you create a project.

Having the option to use different .xcconfig files for each build configuration allows you to place the debug build settings you're constantly changing in one .xcconfig file and place the release build settings you're changing in another xcconfig file. Use multiple .xcconfig files if the build settings you're changing have different values for debug and release builds or if you change some build settings only for debug builds and other build settings only for release builds.

2.How to create a .xcconfig file?
New File----->iOS  Other------>Configuration Settings File


3.How to add the .xcconfig file to the project and do some settings?
Go to your project's info screen, under the configurations section expand the list until you find the target you want your scheme to apply to, then select it from the drop down box.


4. How to write the .xcconfig file?
Look for a build setting you want to add to your .xcconfig file in the build settings list, set it to the value you want it to be, then select that row, hit Command+C to copy, then push delete to get rid of your setting. And then, go into your .xcconfig file and paste the contents of your clipboard. You will notice that you  copied the key and value.





有时候,工程里面需要修改很多setting,在移动修改文件或者拷贝文件到另一个工程中时,需要同时附加这些setting的修改,这个时候,就可以使用.xcconfig文件。

.xconfig文件罗列了setting里面需要修改的key和value。

使用.xconfig文件,需要点击工程名,选择Info标签,打开Configurations栏,分别在debug或者release下选择相应的debug或release配置文件,主要是设置target行的配置。

在配置文件中修改了相应值后,target里的相应值就会跟着发生变化。

在setting列表里,选择一行,然后按复制键(Commnad+C),再到你新增的.xcconfig文件里,按粘贴快捷键(Command+V)将key和value粘贴到里面,注意粘贴的内容并不是setting列表里的"key=value"。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值