网络请求
//一个异步的get请求
NSString * loginString = @"http://118.144.86.100/51miu/webserver/soap/user.php?userName=张三&passWord=123456";
NSString *fullPathEncodingString = [loginString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL * loginURL = [NSURL URLWithString:fullPathEncodingString];
ASIHTTPRequest * loginRequest = [ASIHTTPRequest requestWithURL:loginURL];
loginRequest.delegate = self;
[loginRequest setDidFinishSelector:@selector(loginFinished:)];
[loginRequest setDidFailSelector:@selector(loginFailed:)];
[loginRequest startAsynchronous];
总是对网络请求感到很神奇,尽管项目里用到的soap请求到了网络,但是对于 异步的get和post以及 同步的get,post有什么区别?
get和post有什么区别貌似是面试经常考的东西
NSString *fullPathEncodingString = [loginString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 为什么加这个 是因为 get的参数里有中文的 必须加这个才能发送到服务端