1.ASIHTTPRequest一个简短的引论
github下载链接
2.ASIHTTPRequest 对GET和POST请求简单封装
+(void)requestWithASIURL:(NSString *)urlString parmas:(NSMutableDictionary *)params httpMethod:(NSString *)method completeBlock:(RequestFinishBlock)block{ //处理GET请求 if ([[method uppercaseString] isEqualToString:@"GET"]) { NSArray *keys=[params allKeys]; for (int i=0; i
3.调用格式
NSString* urlString=@"http://192.168.1.101:8080/PengFu/jokController/getPhoneJok"; NSMutableDictionary *params=[NSMutableDictionary dictionaryWithObject:@"1 " forKey:@"rows"]; UIImage *image=[UIImage imageNamed:@"test3.gif"]; [params setObject:image forKey:@"pic"]; [params setObject:@"test gif image upload" forKey:@"status"]; [DataService requestWithASIURL:urlString1 parmas:params httpMethod:@"POST" completeBlock:^(id result) { NSLog(@"%@",result); }];
4.注意事项
下载代码编译报错请先导入网络请求所需的5个库例如以下
假设使用ARC自己主动内存管理。请在源代码编译后面加-fno-objc-arc,例如以下图
版权声明:本文博主原创文章,博客,未经同意不得转载。