Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p><strong>Version 2.17. Build a85b242.</strong></p> </blockquote> <p>If you want to add a pretty versioning like this above, just follow these steps:</p> <ol> <li>Open <code>Build Phases</code> in <strong>Xcode</strong></li> <li>Press <code>Add Build Phase</code></li> <li>Press <code>Add Run Script Build Phase</code>. You can find this in the top menu <strong>Editor</strong>. Drag script-line to the position after <code>Target Dependencies</code>.</li> <li>Set <strong>Shell</strong> line to <code>/bin/sh</code></li> <li><p>Set the script below to the <strong>Script field</strong>. Don't forget to change <strong>Sources</strong> to your path-to-file, where <code>GitVersion.h</code> should be. For example:</p> <pre><code>version=$(git rev-parse --verify HEAD | cut -c 1-7) curdate=$(date +"%d.%m.%y") filesource="//\n// GitVersion.h\n//\n// Created by sig on $curdate.\n//\n\n#ifndef GitVersion_h\n#define GitVersion_h\n\n#define GIT_SHA_VERSION @\"$version\"\n\n#endif" cd ${SOURCE_ROOT}/${PROJECT_NAME} echo -e "$filesource" &gt; Sources/GitVersion.h touch Sources/GitVersion.h </code></pre></li> <li><p>Import <code>GitVersion.h</code> file into <strong>Xcode</strong> project</p></li> <li><p>Paste these lines:</p> <pre><code>NSDictionary *info = [[NSBundle mainBundle] infoDictionary]; NSString *version = [info objectForKey:@"CFBundleShortVersionString"]; NSString *app_version = [NSString stringWithFormat:@"Version %@. Build %@.", version, GIT_SHA_VERSION]; NSLog(@"app_version : %@", app_version); </code></pre></li> </ol> <blockquote> <p>Fully documented answer with images and described advantages could be found <a href="https://github.com/siggb/GitVersioningOnXCode" rel="noreferrer">here</a>.</p> </blockquote>
    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. This table or related slice is empty.
    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