UIWebView

UIWebView请求网络数据

 // 创建UIWebView
    UIWebView *webView = [[UIWebView alloc] init];
    self.webView = webView;
    webView.frame = self.view.bounds;
    [self.view addSubview:webView];
    
    // 创建请求
    NSURL *requestUrl = [NSURL URLWithString:GlobalHelpDocUrl];
    NSURLRequest *request = [NSURLRequest requestWithURL:requestUrl];
    [webView loadRequest:request];

清除UIWebView缓存和Cookie

    // 清除cookie缓存
    NSHTTPCookie *cookie;
    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    for (cookie in [storage cookies]) {
        [storage deleteCookie:cookie];
    }
    
    // 清除webView的缓存
    [[NSURLCache sharedURLCache] removeAllCachedResponses];
    

你可能感兴趣的:(UIWebView)