美文网首页
ATS自动化

ATS自动化

作者: blueshadow | 来源:发表于2016-12-20 20:50 被阅读67次

到了2017.1.1,所有提交的app不允许使用 NSAllowsArbitraryLoads = Yes 来绕过ATS的限制,你必须设置为NO。

Screen Shot 2016-12-20 at 8.50.08 PM.png

如果你的app有着异常复杂的业务逻辑,手动排查找出所有的HTTP请求是非常费时费力的。
于是ATS自动化呼之欲出了。
下面记载了一些ATS自动化遇到的一些问题

定义问题

功能验证时能直接体验到功能的可用与否(或是网页打不开、头像拉取失败)。所以一种可取的方案就是打开ATS开关,功能验证的测试同学们测试用例时辅助发现ATS问题。
但自动化怎么定义问题?

App日志

如果开发们在做HTTP请求时的completion回调里打印了error,那我们还是非常方便的从日志log提取问题的。(NSLog会直接打到控制台)。但如果开发没有打印error,那这部分问题就无法发现了

Screen Shot 2016-12-20 at 8.56.44 PM.png
Dec 20 20:57:50 TKMB161106H9 TestATS[3193] <Notice>: Request failed: Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x170058ed0 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}

系统日志

当然系统还是能觉察到HTTP请求的

Dec 20 20:31:46 TKMB161106H9 TestATS(CFNetwork)[3160] <Notice>: App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
Dec 20 20:31:46 TKMB161106H9 TestATS(CoreFoundation)[3160] <Debug>: Bundle: CFBundle 0x100410840 </System/Library/Frameworks/CFNetwork.framework> (framework, loaded), key: Err-1022, value: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., table: Localizable, localizationName: (null), result: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

但遗憾的是:

  • 这些log并不能看到请求的URL
  • App启动后如果系统发现HTTP请求,那只会打印一次第一条log(即...has blocked a cleartest...)
  • 而第二条(即The resource could not...)只会在App安装后第一次启动发生HTTP请求时打出,以后再也不出现了
    换句话说,系统在一个进程里面发现第一个HTTP请求后会打印log1,之后都不会打印log1(除非强杀进程重新启动app,当然这是另外一个进程了)。打印log2,同时标记对应App,被标记的App不会再打印log2。

怎么办

结合代码搜索,和App日志,我们能发现大部分的问题。当然,剩下的那部分,我也暂时想不到办法了。有高人有大法望留言告知我。

相关文章

  • ATS自动化

    到了2017.1.1,所有提交的app不允许使用 NSAllowsArbitraryLoads = Yes 来绕过...

  • crt文件生成

    Starting ATS Diagnostics nscurl --ats-diagnostics --verbo...

  • iOS 9之适配ATS

    一、简单谈谈ATS(App Transport Security) ATS(App Transport Secur...

  • Apache Traffic Server插件开发手记(一)

    目录 一、编译、安装ATS 二、ATS原理与使用 三、插件开发过程 一、编译、安装ATS 下载解压源代码 wget...

  • The HBase application reported a

    查看ats-hbase状态 yarn app -list yarn app -status ats-hbase 尝...

  • 【转】苹果ATS(强制HTTPS)审核新政解码

    1. ATS App Transport Security(ATS) 是Apple为增强iOS App网络通信安全...

  • ATS

    官方文档参考 要求:如果使用ats 又不满足以下标准则请求被中断并返回nil• The protocol Tr...

  • ATS

    苹果规定 从2017年1月1日起,新提交的 app 不允许使用 NSAllowsArbitraryLoads 来绕...

  • ATS

    强制访问 设置白名单 真机调试http://www.bubuko.com/infodetail-1061938.h...

  • ats

    null

网友评论

      本文标题:ATS自动化

      本文链接:https://www.haomeiwen.com/subject/qskfvttx.html