如何测试/检查NSURLCache的使用? [英] How to test/check use of NSURLCache?
问题描述
我已按照本博客帖子.
但是,由于应用程序本身没有发生任何不同,有没有办法测试此行为并检查其是否按预期工作?仪器中是否有配置文件?当响应被缓存/使用了响应时,可以在Xcode的日志中打印一些内容吗?
However, as nothing different happens in the app itself, is there a way to test this behaviour and check it is working as expected? Is there a profile in instruments? Is there something I can print to the log in Xcode when a response is cached/cached response is used?
实现起来似乎很简单,我想确保它实际上对我的应用程序有影响,并且我自己不必实现缓存系统.
It just seems so simple to implement, I want to make sure it is actually having an effect on my app and that I won't have to implement a caching system myself.
非常感谢,
山姆
推荐答案
您可以通过通过类似Charles的第三方软件分析HTTP流量来确保做到这一点.
You can make sure so by analyzing HTTP traffic through a third party software like Charles.
每当应用发出请求时,HTTP分析工具都会选择发出的请求.如果使用缓存,则将在其中反映出来.
(检查响应的内容以确认相同)
Whenever app will make a request, HTTP Analyzer will pick the request made. If it is using cache, then same will be reflected in it.
(Check the contents of response to confirm the same)
这篇关于如何测试/检查NSURLCache的使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!