Passing html parameters to server odd problem

Posted by StealthRT on Stack Overflow See other posts from Stack Overflow or by StealthRT
Published on 2010-04-11T05:34:05Z Indexed on 2010/04/11 5:43 UTC
Read the original article Hit count: 492

Filed under:
|

Hey all i am having a weird problem with sending data back to my server. This is the code i am using:

 NSString *theURL =[NSString stringWithFormat:@"http://www.xxx.com/confirm.asp?theID=%@&theName=%@&empID=%@&theComp=%@", theConfirmNum, tmpNBUserRow.userName, labelTxt.text, theID];

        NSLog(@"%@,%@,%@,%@", theConfirmNum, tmpNBUserRow.userName, labelTxt.text, theID);

        NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
        [request setURL:[NSURL URLWithString:theURL]];
        [request setHTTPMethod:@"POST"];

        NSError *error;
        NSURLResponse *response;

        NSData *urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
        NSString *data=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];

        if ([data isEqualToString:@"Done"])

I can run the code from the browser and it works just fine using the data i got from the NSLog output. The NSLog output for each value is correct. But for some reason when i put a break on the IF ([data isEqualToString:@"Done"]) it has no return value. I checked each value for what it was sending (and again, it was correct in the NSLog output) and i found that the value "theID" said "Out of scope". Although, again, the NSLog had the value in it correctly?

So i searched the forum and found a simular problem. I took their advice and added "RETAIN" to the "theID" value like so:

theID = [customObjInstance TID];
[theID retain];

However, that did not solve the issue...

Here is the console NSLog output:

 [Session started at 2010-04-11 01:31:50 -0400.]
 wait_fences: failed to receive reply: 10004003
 wait_fences: failed to receive reply: 10004003
 nbTxt(5952,0xa0937500) malloc: *** error for object 0x3c0ebc0: double free
 *** set a breakpoint in malloc_error_break to debug
 2010-04-11 01:32:12.270 nbTxt[5952:207] 5122,Rob S.,5122,NB010203

The NSLog values i am sending is the last line "5122,Rob S.,5122,NB010203"

Any help would be great :o)

David

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about objective-c