Reputation: 4079
i need to send this SomeString To a server by a post request.
without to make it NSData
object and do NSUTF8StringEncoding
the SetHttpBody: ask me only for a NSData object.
how can i Post this String
SomeString = @"registerRecipt.aspx?udid=962c3486-a8d6-4c32-9ff8-7b255cce4d65&receipt=ewoJInNpZ25hdHVyZSIgPSAiQW1wMnhiVGxYTGg5UmhFUUlCMzNLMHdZdHl3Tnd0WWFVaEdKQzNoUE04Rm8wSys4NE5wWkdWdWRFRndjQ0k3Q2draVluWnljeUlnUFNBaU1TNHdJanNLZlE9PSI7CgkiZW52aXJvbm1lbnQiID0gIlNhbmRib3giOwoJInBvZCIgPSAiMTAwIjsKCSJzaWduaW5nLXN0YXR1cyIgPSAiMCI7Cn0="
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://someUrl.com/"]];
request.timeoutInterval = 20;
[request setHTTPMethod:@"POST"];
[request setHTTPBody:SomeString];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
Upvotes: 0
Views: 176
Reputation: 9481
Upvotes: 0
Reputation: 29985
You can use [SomeString dataUsingEncoding:NSUTF8StringEncoding];
Upvotes: 2