public
Last active

A very simple shell script to read .xcodeproj files and check if there are issues with the CODE_SIGN_IDENTITY. Having multiple entries can cause build errors (especially when Archiving or command line building). Link to StackOverflow question answering some questions about when and why to use this: http://stackoverflow.com/q/13962341/89035

  • Download Gist
cs_xproj_validate.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# /bin/bash
 
#Usage: $ ./cs_xproj_validate.sh path/to/xcode/project/file/theproject.xcodeproj
#More info: http://stackoverflow.com/q/13962341/89035
 
PROJECT_FILE="$1/project.pbxproj"
 
PREVIOUS_LINE=-1
 
for LINE in `cat "$PROJECT_FILE" | grep -n CODE_SIGN_IDENTITY | grep -o -E '^([0-9]*)'`
do
TEMP=`expr $PREVIOUS_LINE + 1`
if [ $TEMP -eq $LINE ] ; then
echo "There is a Code Signing Identity (CODE_SIGN_IDENTITY) issue in $PROJECT_FILE at line $PREVIOUS_LINE."
exit 1
fi
PREVIOUS_LINE=$LINE
done
 
exit 0

Thanks so much! I was at the point of considering revoking everything and redoing it all.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.