您的位置:首页 > 产品设计 > UI/UE

NSMutableURLRequest 请求头的设置

2014-04-03 10:15 435 查看
NSURL *url1 = [NSURL URLWithString:[webUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request=[[NSMutableURLRequest alloc]initWithURL:url1 cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:20];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"111318d2-b5a5-1998-be2a-30607d1591ca" forHTTPHeaderField:@"appid"];

NSURLConnection *conn = [[NSURLConnection alloc]initWithRequest:request delegate:self startImmediately:true];
if (conn) {
[conn start]; //发送请求
}


很重要的两句话记住了:就可以设置请求头
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: