我試圖改變各種屬性的單元測試使得所注射的已知設置將不會使用不同的設置干擾實際運行的應用程序(特別是鑰匙扣,但潛在的捆綁標識符太)時Xcode的試驗方案腳本
(我設想這樣做的方法是使用基於plist中KeyChainService
進入單元測試不同的kSecAttrAccessGroup
)
我也是用這個腳本AppCode
打算。
問題是我找不到任何地方放置腳本(或任何變量),它會在任何測試階段之前發生的構建階段覆蓋正常的預執行腳本。
我的bash腳本如下:
plist="${PROJECT_DIR}/${INFOPLIST_FILE}"
if [[ "${plist}" == "/" ]]; then
# AppCode (no variables set)
plist=./myProject-Info.plist
fi
if [[ -z "$csKeyChain" ]]; then
csKeyChain=RUN
fi
if [[ -z "$bundleIdentifier" ]]; then
bundleIdentifier=com.mycompany.abc
fi
echo "Setting KeyChainService to $csKeyChain; CFBundleIdentifier to $bundleIdentifier" > ~/BUILD.txt
/usr/libexec/Plistbuddy -c "Set KeyChainService $csKeyChain" "${plist}"
/usr/libexec/Plistbuddy -c "Set CFBundleIdentifier $bundleIdentifier" "${plist}"