<span style="font-size:24px;">//1.将网址初始化oc字符串对象
NSString *urlString = [NSString stringWithFormat:@"%@",kVideoURL];
//2.创建NSURL对象
NSURL *url = [NSURL URLWithString:urlString];
//3.创建请求
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10];
//4.创建参数字符串对象
NSString *parmStr = [NSString stringWithFormat:@"%@",@"method=album.channel.get&appKey=myKey&format=json&channel=t&pageNo=1&pageSize=10"];
//5.将参数转为nsdata对象
NSData *parmData = [parmStr dataUsingEncoding:NSUTF8StringEncoding];
//6.设置请求体
[request setHTTPBody:parmData];
//7.设置请求方式
[request setHTTPMethod:@"POST"];
//异步链接
[NSURLConnection connectionWithRequest:request delegate:self];</span>
iOS 异步POST
最新推荐文章于 2021-06-18 16:05:47 发布