Integrate Settings.bundle and show iOS version with Git commit in 5 mins

Clarity is for our own good

James Tang
iOS Apprentice

--

Your colleagues experienced a crash on an iPad, your boss reported some performance issues on his iPhone, and you have got a few testing devices up and running…

Now you got those devices in hand, but the questions is which exact version of your app has been installed on which device. Is that the Testflight version built yesterday, or the AppStore version released last week, or is it some adhoc version built on demand?

We need the exact Version, Build and Git commit hash. Without needing to construct a page within the app to show those meta data, we can put it in the iOS Settings panel.

And it’s fairly easy to setup using the following procedures:

1. Download my project and drag Settings.bundle into your project

2. Add this lines of code in your AppDelegate.m

3. Drag “xcode-git-hash.sh” to the root of your project folder.

The original version of the script can be found at https://github.com/AlbertTong/XcodeScriptGitCommitHash

4. Add a Run Script in your Project Target > Build Phases

"${SRCROOT}/xcode-git-hash.sh"

5. Then, add “GITHash” into your target’s info plist.

Leave it empty we’ll generate that

6. Build and Run your app once, then go to Settings panel > YourApp

Ok, didn’t take very long to take us there, right?

Checkout the demo project on Github.

Conclusion

The Settings panel is a great place to place information apart from the app’s UI. You can add toggles, input fields, and preferences to let your users to configure your app.

More info can easily be found at Preferences and Settings Programming Guide.

Feel free to find @jamztang on Twitter and read my other articles!

--

--

James Tang
iOS Apprentice

Sketch Plugins and iOS UX Engineer. Opensource projects contributor, share on Twitter. @jamztang