是否可以仅在调试环境中禁用iOS 9中的ATS? [英] Is it possible to disable ATS in iOS 9 just for debug environment?

查看:66
本文介绍了是否可以仅在调试环境中禁用iOS 9中的ATS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在没有HTTPS设置的开发环境中工作.是否可以仅针对开发(调试)模式自动禁用ATS?

I'm working on a development environment without HTTPS setup. Is it possible to automatically disable ATS just for the development (debug) mode?

推荐答案

我的解决方案是将ATS禁用选项保持为默认NO值,并在构建应用程序包的Info.plist中添加新的运行脚本阶段以对其进行更改.应用程序.

My solution is to keep ATS disable option at the default NO value and add a New Run Script Phase to change it in the app bundle's Info.plist when building the app.

这是脚本:

#Disables ATS in debug builds.
INFOPLIST="${TARGET_BUILD_DIR}"/"${INFOPLIST_PATH}"
case "${CONFIGURATION}" in
"Release"|"Adhoc")
/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads NO" "${INFOPLIST}"
;;
"Debug")
/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES" "${INFOPLIST}"
;; 
esac

这篇关于是否可以仅在调试环境中禁用iOS 9中的ATS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆