@property(weak,nonatomic) UIWebView *webView;
//确定一个要访问的资源
NSURL *url = [NSURL URLWithString:@"http://m.baidu.com"];
//建立请求,准备告诉服务器端,我们客户端需要的资源
NSMutableURLRequest *request =[NSMutableURLRequest requestWithURL:url];
//表明自己的设备属性以返回对应数据
[request setValue:@"Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like MacOS X) AppleWebKit/600.1.4 (KHTML, like Gecko)" forHTTPHeaderField:@"User-Agent"];
//把请求发送给服务器,等处理完后,返回数据
[NSURLConnection sendAsynchoronousRequest:request queue:
[[NSOperationQueue alloc] init] completionHandler:
^(NSURLResponse *response, NSData *data, NSError *connectionError)
{
NSString *heml = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
[self.webView loadHTMLString:html baseURL:nil];
}