简体   繁体   中英

How can I save all my build settings from 1 xcode project and use them on other xcode projects?

I'm using xcode 4.5 and cordova/phonegap to build my apps. I have invested a lot of time into getting the build settings just right for my xcode project and I would like to reuse these settings on multiple apps I am building. I'm looking to see if there is a fast way to export these settings or build a template that I can use for future projects.

I've tried copying the project folder and changing the name and that does not work. I get an error when working with the cordovalib.xcodeproj file.

Any help on exporting these settings or creating a template would be appreciated.

Use an .xcconfig file.

http://developer.apple.com/library/ios/#recipes/xcode_help-project_editor/Articles/BasingBuildConfigurationsonConfigurationFiles.html

File.. New File.. Then choose the Configuration Settings File from the Other section.

You will have to copy the build settings from your xcodeproj file. Open your xcodeproj file in a text editor and copy:

buildSettings = { ... }

Into your xcconfig file. Be aware that the xcconfig file has a specific format. The above video / Apple documentation should help you.

You will then need to tell Xcode which xcconfig file to use for each build configuration.. Debug, Release, etc. You can do this by importing it under your Project's Info tab, under Configurations.

XCConfig files are certainly the way to go for sharing build settings across multiple targets or even projects.

As StuR wrote six years ago, you still add a configuration file from the New File dialog in XCode. It is just a text file with a key value format. The easiest way to add configuration values is — in my opinion — to go to the build settings of your target, select the row of the setting you want to modify and press cmd+c to copy it. When you paste in the config file, it will be inserted in the right format.

To add the config file to your target, you need to go to the project settings. There is a Configurations section where you can set the config files for each target and configuration (Debug, Release, etc)

You find the official documentation for XCConfig files here: https://help.apple.com/xcode/mac/10.1/#/dev745c5c974

One very usefull feature of the XCConfig files is that you can import other XCConfig files and build a kind of inheritance schema.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM