我有一个加载此网址的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];
}
请帮帮我。
答案 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];