Reputation: 774
I am using XCode to build an iPhone application, where I would like to externally process the info plist file in the same manner as the XCode build step shown below does
Processing /Users/kte/Projects/build/Debug-iphonesimulator/TestAppGen.app/Info.plist TestAppGen-Info.plist
mkdir /Users/kte/Projects/build/Debug-iphonesimulator/TestAppGen.app
cd /Users/kte/Projects/TestAppGen
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
<com.apple.tools.info-plist-utility> TestAppGen-Info.plist -genpkginfo /Users/kte/Projects/build/Debug-iphonesimulator/TestAppGen.app/PkgInfo -expandbuildsettings -format xml -o /Users/kte/Projects/build/Debug-iphonesimulator/TestAppGen.app/Info.plist
This excerpt from the build log refers to a com.apple.tools.info-plist-utility, which I gather from various sources around the net, is an internal XCode utility.
Is it possible to run the com.apple.tools.info-plist-utility from a command line?
Upvotes: 3
Views: 2926
Reputation: 25673
The "plutil" answer is a great start. Unfortunately the Xcode build process does more to the Info.plist file than converting it to binary, for example on my system it adds in the fields:
-MinimumOSVersion
-PlatformName
-CFBundleExecutable
-SDKName
-CFBundleResourceSpecification
-CFBundleSupportedPlatforms
According to the Apple documentation you aren't supposed to set up some of these values yourself:
MinimumOSVersion
MinimumOSVersion (String). When you build an iPhone application, Xcode notes the target OS (as determined by the Base SDK selection) as the MinimimOSVersion property. Do not specify this property yourself in the Info.plist file; it is a system-written property. When you publish your application to the App Store, the store indicates the iPhone OS release on which your application can run based on this property. It is equivalent to the LSMinimumSystemVersion property on Mac OS X.
I'm running into all sorts of problems trying to re-sign my application as part of my custom build process.
Upvotes: 2
Reputation: 46041
You can use a tool called PlistBuddy, /usr/libexec/PlistBuddy
, have a look at its man page.
But you will also need to convert the plist back to a binary plist file. This can be done like this in a build script
plutil -convert binary1 "$TARGET_BUILD_DIR/$INFOPLIST_PATH"
Upvotes: 3