in Xcode

Bash Script in Xcode Returning Error

Here is the error details I received when using the plistbuddy script:

Set: Entry, ":CFBundleBuildVersionString", Does Not Exist
File Doesn't Exist, Will Create: /Users/*YourFilePathHere/YourAppName*.app/Info.plist
Set: Entry, ":CFBundleBuildDateVersionString", Does Not Exist
Command /bin/sh failed with exit code 1

Command /bin/sh failed with exit code 1
Command /bin/sh failed with exit code 1

I tried clean and even deleted Derived Data without success. Turns out the actual solution was quite simple. I found that during build the script was trying to add the generated values to the plist before the plist was actually generated by Xcode.

Target > Build Phases
Target > Build Phases

Targets > Build Phases > Extra Version Data is there this script is ran.
However Targets > Build Phases > Copy Bundle Resources is where the plist is generated.

Click and Drag "Extra Version Data" to re-arrange build order
Click and Drag “Extra Version Data” to re-arrange build order

Click and drag Extra Version Data so that it becomes listed after Copy Bundle Resources thus, the plist is built BEFORE the script tries to add the generated values.

Target > Build Phases corrected
Target > Build Phases corrected

Then build and rejoice with a beer.

(Using Xcode 5.1)
Also posted on Stack Overflow

Related Posts

Written By: