Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSData *) queryAuthServer:(NSString *)user queryAuthPass:(NSString *)pass {
- NSString *postDataString = [self generatePostStringFromUser:user pass:pass];
- NSMutableURLRequest *request;
- NSURL *serverURL;
- NSData *postData;
- NSMutableData *responseData = [[NSMutableData alloc] init];
- postData = [postDataString dataUsingEncoding:NSUTF8StringEncoding];
- //postData = [[NSData alloc] initWithBytes:[postDataString UTF8String] length:[postDataString length]];
- //postData = [NSData dataWithBytes:[postDataString UTF8String] length:[postDataString length]];
- //postData = [[NSData alloc] init];
- // ASSERT: postData has been set.
- serverURL = [[NSURL alloc] initWithString:VALIDATION_URL];
- // ASSERT: serverURL has been set
- request = [[NSMutableURLRequest alloc] initWithURL:serverURL];
- [request setHTTPMethod:@"POST"];
- [request setHTTPBody:postData];
- // ASSERT: Setup the POST request to the server to submit the username and password.
- [responseData appendData:[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]];
- // ASSERT: responseData contains XML to be parsed from the POST to the server for validation.
- [request release];
- [serverURL release];
- //[postData release];
- //[postDataString release];
- // ASSERT: Released all the memory used in this method.
- return responseData;
- //return [[NSData alloc] init];
- }
Add Comment
Please, Sign In to add comment