我正在跟踪webview的内存泄漏
initWebUILocalStorageSupport
MobileQuickLookLibrary()
这是我的代码,我不知道我错过了什么。
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0f];
[theRequest setHTTPMethod:@"POST"];
NSData *data = [self GenerateData];
if (data) {
[theRequest setHTTPBody:data];
}
[webView loadRequest:theRequest];
我希望我的问题很清楚。谢谢
编辑:为GenerateData添加代码
NSArray * results = [self.managedObjectContext executeFetchRequest:request error:&error];
if (!error) {
for (Items *item in results) {
}
NSString *theBodyString = [[CJSONSerializer serializer] serializeDictionary:theRequestDictionary];
theBodyData = [theBodyString dataUsingEncoding:NSUTF8StringEncoding];
}
return theBodyData;
答案 0 :(得分:0)
您是在测试模拟器还是在真实设备上?
众所周知,模拟器存在一些实际设备中不存在的内存泄漏。
答案 1 :(得分:0)
尝试:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"WebKitCacheModelPreferenceKey"];
}
来自http://blog.techno-barje.fr/post/2010/10/04/UIWebView-secrets-part1-memory-leaks-on-xmlhttprequest
答案 2 :(得分:0)