【发布时间】:2011-05-16 15:08:33
【问题描述】:
我已经阅读了有关 UIWebView 的很多泄漏问题但我的案例非常简单,所以我决定提出一个新问题。 当我尝试从 WebView loadRequest 方法加载文件时,如果我在 Instruments 中观看,内存 allocation 会不断增加。但是,如果我看到泄漏,则仪器中根本没有泄漏。
我使用的是 4.3 sdk,所以我想它必须是最新的问题。
我已经阅读了这篇文章 Why UIWebView Eating so many Memory? 还有这篇文章http://blog.techno-barje.fr/post/2010/10/04/UIWebView-secrets-part1-memory-leaks-on-xmlhttprequest
但似乎没有什么对我有用。
@interface MyView: UIViewController <UIWebViewDelegate> {
IBOutlet UIWebView *webView;
}
@property (nonatomic, retain) IBOutlet UIWebView *webView;
========= 在我的 MyView 类中
@synthesize webView;
-(void)viewDidLoad {
[super viewDidLoad];
NSString *path = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", pathString]];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:path]] ];
}
-(void)dealloc {
[webView release];
}
等待您的回复。
提前致谢
【问题讨论】:
-
好的格式是你的朋友
标签: iphone cocoa-touch cocoa