Objective c 检查http post请求中发送的数据
是否可以通过在XCode中记录请求来检查我在HTTPPOST请求中发送的数据 这是我的密码:Objective c 检查http post请求中发送的数据,objective-c,http,post,logging,Objective C,Http,Post,Logging,是否可以通过在XCode中记录请求来检查我在HTTPPOST请求中发送的数据 这是我的密码: NSString *post = [NSString stringWithFormat:@"Firstname=%@&Lastname=%@&Email=%@",firstName,lastName,emailId]; NSLog(@"%@", post); NSData *postData = [post dataUsingEncoding:NSASCIIStringEncodin
NSString *post = [NSString stringWithFormat:@"Firstname=%@&Lastname=%@&Email=%@",firstName,lastName,emailId];
NSLog(@"%@", post);
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d",[postData length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"http://www.abcde.com/xyz/login.aspx"]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
**NSLog(@"%@", request );**
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
我正在用粗体记录请求,如上所示。但在这里,我只能看到我的Url,而不能看到任何帖子数据
如果无法在此处查看数据,我可以在何处查看http请求中发送的数据。如果您只想查看您发送的数据,我建议您使用这个很棒的工具。它非常简单和强大。 只需运行Charles并通过模拟器执行您的请求 您的意思是
NSLog(@“PostData:%@”,request.HTTPBody)代码>?