在Build Phases中添加腳本
#!/bin/bash
bundleID=${PRODUCT_BUNDLE_IDENTIFIER}
echo $bundleID
result=$(echo $bundleID | grep "knamestr")
if [[ "$result" != "" ]] ; then
/usr/libexec/PlistBuddy -c "Set :CFBundleName 名稱1" "$INFOPLIST_FILE"
else
/usr/libexec/PlistBuddy -c "Set :CFBundleName 名稱2" "$INFOPLIST_FILE"
fi