Skip to content

Instantly share code, notes, and snippets.

@dmiedema
Last active December 26, 2015 00:09
Show Gist options
  • Save dmiedema/7062251 to your computer and use it in GitHub Desktop.
Save dmiedema/7062251 to your computer and use it in GitHub Desktop.
Saving my Podfile structure for adding the Acknowledgements.plist generated by cocoa pods into my Settings.bundle, soon to be part of my default app template.

How to actually use these

Go to File->New->File->Resource->Settings Bundle

  1. Replace the contents of Root.plist with the contents of this Gists Root.plist.
  2. Add whatever other fields you want
  3. Put the following inside your AppDelegate.m file to have the Version/Build set from the apps current settings
    /* Settings App Bundle */
    NSString *build = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
    [[NSUserDefaults standardUserDefaults] setObject:build forKey:@"build_preferences"];
    NSString *verison = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
    [[NSUserDefaults standardUserDefaults] setObject:verison forKey:@"version_preferences"];
  1. ?????
  2. Profit
platform :ios '7.0'
# Put pods here...
# Automatically put the acknowledgements in the Settings.bundle
post_install do | installer |
require 'fileutils'
FileUtils.cp_r('Pods/Pods-acknowledgements.plist', File.basename(Dir.getwd) << '/Settings.bundle/Acknowledgements.plist', : remove_destination => true)
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>About</string>
</dict>
<dict>
<key>DefaultValue</key>
<string>0.0.1</string>
<key>Type</key>
<string>PSTitleValueSpecifier</string>
<key>Title</key>
<string>Version</string>
<key>Key</key>
<string>version_preferences</string>
</dict>
<dict>
<key>DefaultValue</key>
<string>0</string>
<key>Type</key>
<string>PSTitleValueSpecifier</string>
<key>Title</key>
<string>Build</string>
<key>Key</key>
<string>build_preferences</string>
</dict>
<dict>
<key>DefaultValue</key>
<string>Legal Stuff</string>
<key>Type</key>
<string>PSChildPaneSpecifier</string>
<key>Title</key>
<string>Acknowledgements</string>
<key>File</key>
<string>Acknowledgements</string>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment