使用网络阅读器时的文档和数据
我使用 WebViewController 来访问应用程序中的某些 URL。 现在我发现每次使用 WebViewController 时应用程序的大小都会慢慢增加。 当检查 iPhone 使用情况下的应用程序大小时,该特定应用程序的文档和数据会随着每次使用而增加。该应用程序安装时可能为 2 Mb,但经过大量使用后,它可能会轻松增加到 25 Mb。关闭应用程序时如何释放该指纹?
当调用 WebViewController 时,它就是这样的。
- (void) showURL:(NSURL *)address withTitle:(NSString *)title
{
MyWebViewController *vc = [[MyWebViewController alloc] initWithNibName:@"MyWebViewController" bundle:nil];//ny
vc.title = title;
vc.location = address;
[self.navigationController pushViewController:vc animated:YES];
[vc release];
}
h. WebWiewController 中的文件的内容中有此内容。
NSURL *location;
IBOutlet UIWebView *theWebView;
m.file 有这个
- (void)viewDidLoad
{
[super viewDidLoad];
[theWebView loadRequest:[NSURLRequest requestWithURL:location]];
}
I use a WebViewController to visit some URL's in an app.
Now I found out that the apps size slowly increases every time using the WebViewController.
It is when checking app size under iPhone usage and the Document and Data for that specific app increases for every time it is used. The app can be 2 Mb when installed but after a lot of usage it may easily increase to 25 Mb. How can I release that fingerprint when closing the app??
When calling for the WebViewController this is how it looks.
- (void) showURL:(NSURL *)address withTitle:(NSString *)title
{
MyWebViewController *vc = [[MyWebViewController alloc] initWithNibName:@"MyWebViewController" bundle:nil];//ny
vc.title = title;
vc.location = address;
[self.navigationController pushViewController:vc animated:YES];
[vc release];
}
h. file in WebWiewController has this in its content.
NSURL *location;
IBOutlet UIWebView *theWebView;
and the m.file has this
- (void)viewDidLoad
{
[super viewDidLoad];
[theWebView loadRequest:[NSURLRequest requestWithURL:location]];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您的 Webview 正在缓存该页面。
也许您应该手动创建 http 请求来自定义缓存策略。
例如:
我没有尝试代码,只是为了提供一个想法。
It seems that your Webview is caching the page.
Maybe you should manually create your http request to custom the cache policy.
for example :
I did not try the code, it's just to give an idea.