Wednesday, January 31, 2018

Add Bundle Items for specific Scheme?

Leave a Comment

I would like to add some bundle items just for a specific scheme. I could create a run-script, but there i am unable to read out the current scheme.

Is there another chance to add some bundle files only for a specific scheme in xCode 9.x?

3 Answers

Answers 1

In script you can get your current build configuration.

You can duplicate your current build configuration, this will save all your settings for that config. After that rename your new config and refer to it in your scheme you would like to add bundle items to (there is no need to use separate scheme, you can say that, for example, you want to add that resources only for running. In that case just set your new config to Run build configuration of your existing scheme).

After you have all set up you can check on specific config in your run-script like this:

if [ "${CONFIGURATION}" = "BetaDebug" ] || [ "${CONFIGURATION}" = "BetaRelease" ] ; then // Do something specific for that config elif [ "${CONFIGURATION}" = "ProductionDebug" ] || [ "${CONFIGURATION}" = "ProductionRelease" ] ; then // Do something specific for that config fi 

where "${CONFIGURATION}" is config name.

Answers 2

Run the script like this after Copy Bundle Resources phase:

if [ "${CONFIGURATION}" = "Release" ]; then cp -r ${PROJECT_DIR}/Settings/production/Settings.bundle "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app" fi 

Answers 3

Unfortunately you can't add a file just for a specific scheme using Xcode 9, but You can create a new target duplicating the other one, and you can configure your particular scheme to build that special target. In this way you can add files just to the special target (and indirectly to the special scheme) For target duplication it's very easy to do. You can take a look at this answer

Here you can find a tutorial on how to use targets to manage development builds Vs production builds.

Hope this answer your question.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment