read

When working on open source projects, the first thing you often have to do is to change the target’s signing to your own Team and Bundler Identifier.

I was doing exactly that on a new open source project.

But every time the project has updates, you have to set the Team and Bundler Identifier again..

A faster way using xcconfig

xcconfig is simply a file with key-value pairs. You can add new file, and setup as such:

DEVELOPMENT_TEAM = ORIGINAL_TEAM_ID
ORGANIZATION_IDENTIFIER = com.originalcompany

#include? "DeveloperSettings.xcconfig"

Your DeveloperSettings.xcconfig

Then in your very own DeveloperSettings.xcconfig, override with your own:

DEVELOPMENT_TEAM = YOUR_TEAM_ID
ORGANIZATION_IDENTIFIER = com.yourcompany

This file should be added to gitignore, since every developer will have their own.

Configure project

The open source project has to be changed as such:

  • Project > Configurations > Set the configuration file to the xcconfig
  • In Build Settings, remove DEVELOPMENT_TEAM
  • In Build Settings, change PRODUCT_BUNDLE_IDENTIFIER to "$(ORGANIZATION_IDENTIFIER).whatever"

These are the changes in a commit for the Mixed Reality project.

UPDATE: Extractor Tool

Thanks to iOS Dev Weekly for featuring this post, and sharing a nice tool that to extract configurations from the project into xcconfig files. Check out BuildSettingExtractor


Image

@samwize

¯\_(ツ)_/¯

Back to Home