xcode - 通过新构建系统使用 PlistBuddy 修改应用程序传输安全性
问题描述
我在构建阶段添加了一个脚本作为运行脚本,它试图修改应用程序传输安全配置。该脚本似乎不适用于 Xcode New Build System。特别是,当我在 Simulator ( DevelopmentDebug
) 中执行应用程序时,我仍然遇到 ATS 错误。
你有没有遇到过同样的问题?
echo "Run Application Transport Security script for ${CONFIGURATION}"
if [[ ${CONFIGURATION} == "DevelopmentDebug" || ${CONFIGURATION} == "DevelopmentRelease" ]]; then
# Delete any existing NSAppTransportSecurity configurations
/usr/libexec/PlistBuddy -c "Delete :NSAppTransportSecurity" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
# Add the NSAppTransportSecurity dictionary again
/usr/libexec/PlistBuddy -c "Add :NSAppTransportSecurity dict" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
# Add NSAllowsArbitraryLoads and set it to true
/usr/libexec/PlistBuddy -c "Add :NSAppTransportSecurity:NSAllowsArbitraryLoads bool true" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
# Add NSAllowsArbitraryLoadsInWebContent and set it to true
/usr/libexec/PlistBuddy -c "Add :NSAppTransportSecurity:NSAllowsArbitraryLoadsInWebContent bool true" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
fi
# Print Info.plist result
/usr/libexec/PlistBuddy -c "Print" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
解决方案
推荐阅读
- c# - 如何更好地在 C# 中将 continueWith 替换为 async/await
- javascript - 与非门是如何实现的?(概念上)
- java - 如何返回我调用该方法的对象?
- spring-boot - 如何处理春季网络流中的会话过期?
- java - 程序如何知道使用哪种方法(多态性)
- c# - 使用 WPF 的关键帧动画在多个步骤中
- c - 如何将文件中的数据转换为C中的结构?
- excel - 在 VBA 代码中,如何使用每个单元格方法将值添加到列表框并定义范围 End(XlDown)?
- linux - 如何验证我的 cron 作业将在 AWS 上使用 Ubuntu 运行?
- r - 如何在 R plotly chloropleth maps 中使用非默认色标?