Last Updated: August 23, 2018
· kronenthaler

Modifying XCode projects via command line

As part of the iOS developer tasks, I have to create plugins for Unity3d to interact with native libraries. So far, so good. But what happen if you want to modify programmatically, via scripts, or command line the XCode's project to automatically add dependencies and files?
Short answer: good luck with that, the format is not documented at all. It's a big black box.
Fortunately, one fella (https://bitbucket.org/darktable) made part of the work creating a python script to modify XCode's project files.
But there is small hiccup with this script, it doesn't write the latest XCode format, so Unity3d won't be able of update the project if something has changed.
Therefore, i just decided to fork the project (https://github.com/kronenthaler/mod-pbxproj) and extended it to write the right format and give it back to the community, so XCode, Unity3d and the developers may live in peace.

may the fork be with you.

4 Responses
Add your response


put a date on your blog please

over 1 year ago ·

+1 for "put a date on your blog please". It's intensely irritating to find tech blogs without dates on the posts.

over 1 year ago ·

Manually Timestamp your comments then guys, don't get on someone's case because the platform their using doesn't have features you want.

Maybe you could avoid being so short sighted and log a feature request with coderwall, I agree that it's a huge oversight, but don't blame the poster.

over 1 year ago ·

I have a Xcode project that outputs a Mac app that is distributed outside the Mac App Store. It works fine. Now, the client wants it in the Mac App Store. To achieve this I've disabled several features of the original app. Now, I'm facing the question: how to integrate the build process of the Mac App Store app in a painful-less way? For the Non-Mac App Store app we use Jenkins.https://mathway.vip/

I thought it could be possible to keep the non-Mac App Store project settings and then enable/disable/modify it with command line. Errrrr!. I'm wondering if anyone else have faced the same situation and how did you solve it?. Or maybe I'm opening Pandora's box wit my current approach.
To list the stuff I need to enable/disable:

Disable source code. Solution: ifdefs
Enable the app-sandbox. Solution: adding 'com.apple.security.app-sandbox' to entitlements.
Delete dependencies in the 'Target dependencies'. Solution: ????.
Delete libraries in the "link binary with libraries". Please, note that the libraries are already listed in Xcode project settings, I want to delete them.
Change the signing profile. Solution: Add a new scheme with the right values (Mac App Store).
FYI. I'm using Xcode 5.1.1.https://cleanmaster.me/

4 months ago ·