Question

The URL is written properly, I tested it in the browser with data and it sends properly, but when I make the request, it returns that it is successful, but it does not actually write the data. Any idea?

- (void)writeAboutMe:(NSString *)about withIcebreaker:(NSString *)icebreaker 
{
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
NSString *urlString = [NSString stringWithFormat:@"http://nailorbail.net63.net/submit_about_and_icebreaker.php?username=%@&about=%@&icebreaker=%@",[SignInViewController getUsernameString] ,about,icebreaker];
NSLog(@"%@",urlString);
[request setURL:[NSURL URLWithString:urlString]];

[request setHTTPMethod:@"GET"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Current-Type"];
NSURLConnection *conn = [[NSURLConnection alloc]initWithRequest:request delegate:self];
if(conn)
    NSLog(@"Connection Successful");
else
    NSLog(@"Connection could not be made");
[conn release];
}
Was it helpful?

Solution

It could be an encoding issue. What kinds of characters are in getUsernameString, about, and icebreaker? As Maudicus mentioned, you need to handle special characters in the URL yourself.

Try:

urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]

OTHER TIPS

You have set up an asynchronous connection. Do you implement the NSURLConnection delegate protocol methods? Are any of them being called?

The creation of the connection instance doesn't say anything about it's success.

Check out some tutorials, like this one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top