I'd like to write a script that can read info like Bundle Identifier or maybe version number from the Info.plist of the app. Xcode doesn't seem to give that information in it's environment variables. Is there any other way to get them in sh/bash?
相关问题
- How to get the return code of a shell script in lu
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
相关文章
- 使用2台跳板机的情况下如何使用scp传文件
- In IntelliJ IDEA, how can I create a key binding t
- shell中反引号 `` 赋值变量问题
- How get the time in milliseconds in FreeBSD?
- Could I create “Call” button in HTML 5 IPhone appl
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
The
defaults
command can read/write to any plist file, just give it a path minus the.plist
extension:This pulls the
CFBundleIdentifier
value directly from the application bundle'sInfo.plist
file.Defaults also works with binary plists without any extra steps.
Using PlistBuddy, an app by Apple it is possible to assign the string to var like this:
Where BUILD_ROOT and INFOPLIST_PATH are variables set by Xcode if you run this script in a "Run Script" build phase.
You can just read the file directly from the built product. However, if you look at the info.plist file itself in the editor you will see the shell variables themselves. E.g. the Bundle ID is has the following shell command:
You can call
${PRODUCT_NAME:rfc1034identifier}
in any shell script that Xcode runs and it should populate.There is a command line program installed on the Mac called PlistBuddy that can read/write values in a plist. Type 'man PlistBuddy' in Terminal to get more info.