Command line tool to add resources to an Xcode pro

2019-07-02 00:13发布

问题:

I've got an Xcode project that creates a standard application that can be branded in multiple ways and contain some custom content. At the moment I have a Resource "Resources > Tour Packages" with the custom files under this. At the moment every time I want to brand the app a different way I have to delete the old files from this resource and then manually add the new versions via the XCode UI. I can't post and image but it is here - http://img.skitch.com/20100121-xub48r6e1p857c84hdrgg25dw6.jpg).

My Question: Is there a command line tool that performs the same operation?

回答1:

You'd probably be better off just creating multiple targets in your Xcode project, and associating the resources for each branded version of the app with one target.

To do this, just right-click on your target and select Duplicate. You should then remove the custom resources from the Copy bundle resources build phase. You can then add a new set of resources to the Copy bundle resources build phase that are specific to the new target. You can then build any target you like by selecting it from the Active Target popup in the Xcode toolbar or by selecting it in the Project > Set Active Target menu.

This way, you can easily build different versions of your app without having complete duplicates of all your source, difference Xcode projects etc.



回答2:

Yes, the xcodeproj ruby gem allows you to add resources. https://rubygems.org/gems/xcodeproj/versions/0.28.2