Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Using different targets for different editions of Apps provides more flexibility and lets you easily change the bundle identifier and the icon etc once you specify a different plist file per target. However, the configurations are more deeply integrated with Xcode and you can adjust any <code>build setting</code> per configuration.</p> <p>After some more research I figured out how to get the best of both worlds with just one target:</p> <ul> <li>Create the desired configurations in Xcode: <code>ProjectName &gt; ProjectName &gt; Info</code>. For example: <ul> <li>Debug</li> <li>Preview</li> <li>Release</li> </ul></li> <li>Now these three configurations are available for all the build settings.</li> <li><p>The three Apps should co-exist on a device. I want to be able to have all three versions of the App on one device, for this all three types need a different bundle identifier. The original Identifier could be <code>com.company.${PRODUCT_NAME:rfc1034identifier}</code>.</p> <ul> <li>To achieve this go to <code>MyProject &gt; MyApp (Target) &gt; Build settings</code> and click on the button <code>(+) Add Build Setting</code></li> <li><p>Add the new key <code>${APP_ID}</code> and set the values like this and note that the <code>release</code> configuration should not have a suffix:</p> <pre><code>APP_ID &gt; 'com.company.MyApp-debug' &gt; 'com.company.MyApp-preview' &gt; 'com.company.MyApp' </code></pre></li> <li>Now in your <code>Info.plist</code> change the <code>Bundle Identifier</code> value to <code>${APP_ID}</code></li> </ul></li> <li><p>You can do the same with the <code>Bundle Display Name</code> or the <code>Icon</code> attribute so that you can easily distinguish the app at one glance.</p></li> <li>You can set <code>Preprocessor macros</code> for your configurations in order to be able to detect the current configuration in your code. This is done by default for the <code>debug</code> configuration: <code>DEBUG=1</code>.</li> </ul> <h2>Advantages</h2> <ul> <li>Since the three Apps have their own identifier, you won't override the latest preview build when testing the current App in Xcode.</li> <li>Nicely integrated into Xcode and offers a high flexibility<br> All build settings can now individually be changed per configuration</li> <li>New configurations can easily be added by cloning existing configurations within Xcode</li> <li>No need for additional targets<br> Targets are IMHO better for completely different artifacts like libraries or testing targets that have a different code base.</li> <li>The configurations can be used in code if required.</li> <li>Different Service URLS etc. can be used for different environments. See this <a href="http://blog.carbonfive.com/2011/06/20/managing-ios-configurations-per-environment-in-xcode-4/">great post</a> (Thanks to Jonah!) that shows how to do this using a special <code>plist</code> file.</li> <li>No use of any hacky scripts which are hard to maintain</li> </ul> <h2>Disadvantages</h2> <ul> <li><p>With using targets it would be possible to exclude some frameworks from a type of App. So for example you could exclude some analytics library from the <code>debug</code> edition of your App.</p></li> <li><p><strong>Update</strong>: You can't use substitutions like <code>com.company.${PRODUCT_NAME:rfc1034identifier}</code> for User defined Build Settings. So you'll have to write out the bundle whole bundle identifier in this case.</p></li> <li><p><strong>Update</strong>: Some settings which should be made "configuration aware" move to the User-Defined section of the Build Settings, which might feel unusual for some developers.</p></li> </ul> <h2>The result</h2> <p><a href="http://i.minus.com/jbwPgEiBra39dL.png">Result http://i.minus.com/jbwPgEiBra39dL.png</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload