POST w aplikacji Objective-C na iPada

Próbuję wykonać żądanie POST i nie mogę zrozumieć, co się dzieje źle. Otrzymuję odpowiedź z serwera, ale moja para adresów e-mail / hasła nie wydaje się być prawidłowo wysyłana / odczytywana (przez serwer) i mówi mi, że takie konto nie istnieje.

Oto mój kod zawarty w funkcji (która jest wywoływana, gdy użytkownik naciśnie przycisk „login”, który utworzyłem). Uwaga: zmienne „email” i „hasło” są ustawione na wartości w 2 polach tekstowych, które również utworzyłem.

NSURL *url = [NSURL URLWithString:@"http://mydomain.com/login-ipad/"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *messageBody = [NSString stringWithFormat:@"email=%@&user_pass=%@",email,password];
NSString *msgLength = [NSString stringWithFormat:@"%d", [messageBody length]];
[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest setHTTPMethod:@"POST"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Current-Type"];
[theRequest setHTTPBody:[messageBody dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if(theConnection)
{
    NSLog(@"Connection Successful");
    parent.loginButton.enabled = NO;
    receivedData = [[NSMutableData data] retain];
}
else
{
    UIAlertView *alert1 = [[[UIAlertView alloc] initWithTitle:@"Alert" message:@"There was an issue sending the data. Please check your internet connection." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
    [alert1 show];
}

Czy ktoś widzi coś złego w mojej logice?

questionAnswers(2)

yourAnswerToTheQuestion