Question

I just can't figure out how to do this.

I have a special Build Configuration alongside Debug and Release. (Let's call it Foo)

My CFBUndleIdentifier is com.my-company.our-project.

However, when I build (and archive) for the Foo configuration, I want to use the bundle identifier com.my-company.foo.our-project

Is this possible? Everything I've tried has failed.

Was it helpful?

Solution

I spend much of my day building a white-label product, so I have to do this all the time.

The solution we came up with was to use an Xcode "Run Script" build phase as a "postflight" script.

In your project file, select the target, Build Phases, and then add a new "Run Script" build phase. I renamed the phase to "postflight" and ensured to move the phase to be the last thing done amongst all the build phases.

The essential thing the postflight script does is look for the built .app package, look for the Info.plist within it, and then change the CFBundleIdentifier within it for whatever our present build configuration is set for. Our script does a lot more than just this (other logic, post-processing, resource manipulations, etc.).

I can't provide too many specifics since my setup is customized for me, and yours is obviously customized for you. But that's the basic approach. Hopefully it'll work for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top