webview中的内存警告

时间:2015-02-09 10:21:24

标签: ios objective-c iphone ipad uiwebview

我有一个加载此网址的webview https://sketchfab.com/models/9fb581d7cb414e0fbec4108099a73619/embed

加载此网址后,我的网页视图开始显示内存警告,并在一段时间后崩溃。我在我的应用程序中使用弧 这是我的代码:

(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.

NSURL *sUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@/embed",m_Data.m_sModelUrl]];
NSMutableURLRequest *sRequest = [NSMutableURLRequest requestWithURL:sUrl];
[sRequest setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];

[m_webView loadRequest:sRequest];

}

请帮帮我。

1 个答案:

答案 0 :(得分:0)

您可以尝试autoreleasepool来解决内存警告。

@autoreleasepool
{
    NSURL *sUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@/embed",m_Data.m_sModelUrl]];
    NSMutableURLRequest *sRequest = [NSMutableURLRequest requestWithURL:sUrl];
    [sRequest setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
}
[m_webView loadRequest:sRequest];