サーバーにデータを送信しようとしています.リクエストを送信すると、サーバーに送信されますが、サーバーは空白になります.なぜそれが起こったのかわかりません.これを解決するのを手伝ってください.
NSArray *keys = [NSArray arrayWithObjects:@"username",@"password",@"email",@"fullname",@"phone",@"status",nil];
NSArray *objects = [NSArray arrayWithObjects:@"test",@"123456",@"test999@test.com",@"name",@"234566343",@"1",nil];
NSDictionary *questionDict = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
NSDictionary *jsonDict = [NSDictionary dictionaryWithDictionary:questionDict];
NSString *jsonRequest = [jsonDict JSONRepresentation];
RequestHandler *handler = [[RequestHandler alloc] init];
handler.method = @"POST";
handler.delegate = self;
NSLog(@"JSOnRequest -- %@",jsonRequest);
handler.postData = jsonRequest;
handler.requestName = @"registration";
handler.URL =@"http://demo.keshavinfotech.com/edv/user_register.php?";
[handler startRequest];
[handler release];
- (void)startRequest
{
NSURL *requestURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@",mRequestURL]];//NSURLRequestReturnCacheDataElseLoad
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:requestURL
cachePolicy:NSURLRequestReturnCacheDataElseLoad
timeoutInterval:mTimeOut];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [mPostData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody:[mPostData dataUsingEncoding:NSUTF8StringEncoding]];
self.connection = [[[NSURLConnection alloc]initWithRequest:request delegate:self] autorelease];
}
それはサーバーのエンコード/デコードの問題ですか、それとも何か他のものですか???