Compiling inappropriate files in Xcode

I have several pairs of files:

mydata.json, mydata.raw other.json, other.raw, etc ...

The custom tool creates these files in data files that will be used by my application, for example:

mydata.dat, other.dat, etc.

What is the correct way to configure Xcode to generate these resource files? Any of these could change, so I can't just set up my own build rule for the .raw file, for example. I was thinking about using an "external build" project using make, but I don't know how to log the results with Xcode to copy as a resource.

+2


source to share


1 answer


You just have to add a Script run phase for your target in Xcode to run the external build tool and copy the resulting files into your app bundle. Right click on your target and select Add> New Build Phase> New Run Script Build Phase.

You can use any scripting environment you prefer, just specify its path in the "Shell" field. For example, for a bash script, specify / bin / bash.



Then you can use the predefined Xcode environment variables to get the location of the various folders in the built-in package. See Xcode Build Customization Reference for details . For example, the Resources folder in an application bundle is located in ${UNLOCALIZED_RESOURCES_FOLDER_PATH}

.

+2


source







All Articles