Is there a way of automatically writing custom values to the bundle's .plist during a build phase?
I’m setting up a CI system using Jenkins and am using agvtool to bump and set marketing & technical versions at build time.
In addition to setting the versioning at build time it would be very useful to set a couple of of custom values in the .plist.
Is this possible?
- xcodebuild workspace and scheme
- Conditionally build app with different asset catalogs
- Xcode 4.5 Command Line Tools - xcode-select issue
- How to add “Other Linker Flags” to xcode project using command line?
- KeyChain integration causing crash with “missing entitlement” error — via command line builds
- Updating Xcode yields error “cannot find code object on disk” during codesigning
Solutions Collect From Internet About “Is there a way of automatically writing custom values to the bundle's .plist during a build phase?”
You can edit the Info.plist at build time by taking advantage of the “Pre-actions” options to run a script.
Here’s an example script that increments a Key in the Plist called UserDefinedVersionNumber
#!/bin/sh #Grabs info from plist plist=$SRCROOT"/"$INFOPLIST_FILE currentBuild=`/usr/libexec/PlistBuddy -c "Print :UserDefinedVersionNumber" "$plist"` #And changes it before writing out the plist again if [ -z "$currentBuild" ] then currentBuild=1 /usr/libexec/PlistBuddy -c "Add :UserDefinedVersionNumber string $currentBuild" "$plist" else currentBuild=$(($currentBuild + 1)); /usr/libexec/PlistBuddy -c "Set :UserDefinedVersionNumber $currentBuild" "$plist" fi
You should be able to type the script directly into that little box, but I find that editing and maintaining it can become troublesome, especially for shared scripts.
- NSMetaDataQuery never calls back with NSMetadataQueryDidFinishGatheringNotification
- Take a picture on iPhone without showing controls
- Use boost library in cocoa project
- How To set Custom repeat interval For Nslocal Notification…?
- Access iOS Control Center using appium
- How to fully remove Xcode 4
- Text to Speech on iOS
- How could I request text from a Website In Swift?
- Swift & SpriteKit – How to present alert view in GameScene
- How to rotate UIImage
- Iphone and right-to-left text
- getting events from facebook page
- how to repeat animation forever in Swift (HUGE_VALF)?
- NSTextField – White text on black background, but black cursor
- -: unrecognized selector sent to instance 0x8943940 while parsing JSON Page to UITableView