在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