Hi everyone,
I'm sure this is a really simple question. I have a user entered item in a NSTextField form. When the user enters the information, they hit post, and it sends the data to he server.
Unfortunately, it's not sending the data, but some sort of encoded value. How do I get xcode to preserve the string i'm sending?
Example from header file:
and the method:
But the data sent looks like this:
Notice that textValue has become <NSTextField: 0x1001417d0>, which ofcourse is driving the server nuts. The funny thing is this works great on the iphone. Just not the Mac. Thank you so much!
**note: There maybe syntax errors in here from my editing to take out a few things. But the problem still exists.
I'm sure this is a really simple question. I have a user entered item in a NSTextField form. When the user enters the information, they hit post, and it sends the data to he server.
Unfortunately, it's not sending the data, but some sort of encoded value. How do I get xcode to preserve the string i'm sending?
Example from header file:
Code:
@interface LoginForm : NSObject {
IBOutlet NSTextField *textValue;
//---web service access---
NSMutableData *webData;
NSMutableString *soapResults;
NSURLConnection *conn;
//---xml parsing---
NSXMLParser *xmlParser;
BOOL *elementFound;
}
@property (nonatomic, retain) NSTextField *textValue;
- (IBAction)doLogin:(id)sender;
@end
and the method:
Code:
- (IBAction)doLogin:(id)sender{
[theRequest setHTTPMethod:@"POST"];
// Set useful headers
[theRequest setValue:@"text/xml" forHTTPHeaderField:@"Accept"];
[theRequest setValue:@"application/xml" forHTTPHeaderField:@"Content-type"];
// The body
NSString *theRequest =
[NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">\n"
"<soap:Header>\n"
"<context xmlns=\"urn:myapp\">\n"
"<userAgent name=\"myuseragent\"/>\n"
"<session xmlns=\"\"/>\n"
"</context>\n"
"</soap:Header>\n"
"<soap:Body>\n"
"<MyRequest xmlns=\"urn:myauth\">\n"
"<text xmlns=\"\">%@</text>\n"
"</MyReqest>\n"
"</soap:Body>\n"
"</soap:Envelope>\n", textValue,
];
But the data sent looks like this:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<context xmlns="urn:myapp">
<userAgent name="myuseragent"/>
<session xmlns=""/>
</context>
</soap:Header>
<soap:Body>
<MyRequest xmlns="urn:myauth">
<text xmlns=""><NSTextField: 0x1001417d0></text>
</MyRequest>
</soap:Body>
</soap:Envelope>
Notice that textValue has become <NSTextField: 0x1001417d0>, which ofcourse is driving the server nuts. The funny thing is this works great on the iphone. Just not the Mac. Thank you so much!
**note: There maybe syntax errors in here from my editing to take out a few things. But the problem still exists.