ASI http リクエスト、投稿フォーム、
リクエストの本文を確認すると、空のように見えます。本文が何であるかを確認するにはどうすればよいですか?なぜ空なのですか?
ありがとう!
- (void)sendUnsentEntries {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (!sendingEntries) {
sendingEntries = YES;
Reachability *reachability = [Reachability reachabilityForInternetConnection];
BOOL errorsSending = NO;
NSInteger unsentCount = 0;
if ([Client unsubmittedCount] > 0 && [reachability isReachable]) {
NSString *host = [self apiHost];
for (Client* clientToSend in [Client allUnsubmitted]) {
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@", host]];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setValidatesSecureCertificate:NO];
request.requestMethod = @"POST";
[request setPostValue:clientToSend.name forKey:@"name"];
[request setPostValue:clientToSend.territory forKey:@"territory"];
NSLog(@"name:: %@", clientToSend.name);
//LOGING THE FOR THE REQUEST
NSString *requ = [[[NSString alloc] initWithData:[request postBody] encoding:NSUTF8StringEncoding] autorelease];
NSLog(@"request body: %@", requ);
[request startSynchronous];
NSError *error = [request error];
if (!error) {
NSString *responseString = [request responseString];
NSLog(@"response :::%@",responseString);
if ([responseString isEqualToString:@"true"]) {
clientToSend.submitted = [NSNumber numberWithBool:YES];
}
} else {
NSLog(@"error: %@", [error description]);
}
[[self managedObjectContext] save:nil];
}
unsentCount += [Client unsubmittedCount];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:unsentCount];
if (errorsSending && showSendingErrors) {
}
}
sendingEntries = NO;
[pool release];
}
}
だから私は私のログを取得します::request body:
空の応答、
これはフォームの本文をログに記録する方法ですか?
ありがとう!