我寫的啓用Cordova項目中的推送通知的腳本。
您需要修改它才能將DevelopmentTeam設置爲正確的值。
鉤/ before_compile/capabilities.sh
#!/bin/sh
# Abort on Error
set -e
APP_NAME=$(sed -e 's/xmlns.*/>/g' config.xml | xmllint --xpath '/widget/name/text()' -)
PROJECT=`find platforms/ios/${APP_NAME} -name project.pbxproj`
# Exit if not required
grep 'TargetAttributes' ${PROJECT} > /dev/null && exit
# Backup
set -x
cp ${PROJECT} ${PROJECT}.orig
# Get ID
ID=`grep -A 1 'Begin PBXNativeTarget section' ${PROJECT} | tail -n 1 | cut -d ' ' -f 1 | tr -d '\t'`
# Inject
sed -i '' -e "/LastUpgradeCheck.*$/a\\
TargetAttributes = {\\
${ID} = {\\
DevelopmentTeam = ABCD1234YZ;\\
SystemCapabilities = {\\
com.apple.Push = {\\
enabled = 1;\\
};\\
};\\
};\\
};" ${PROJECT}
# Compare
diff ${PROJECT}.orig ${PROJECT}