people,
I’m using JSON touch inmy iphone app.
Now I have to send a string and then an array to server, how can I do this?
I get data from json requests succefully, but I have to send some data.
Here is the code I’ve got so far:
-(void)subimtSelection:(int)aNumber
{
NSString *choiceData=[NSString stringWithFormat:@"%d", aNumber];
NSError *theError=nil;
[[CJSONSerializer serializer] serializeString:choiceData error:&theError];
NSDictionary *jsDic=[NSDictionary dictionaryWithObject:choiceData
forKey:@"selection"];
//WHAT SHOULD I DO NEXT?
}
You can use
ASIHTTRequestto POST string/json data to server:If you want to post a string value then try:
ASIHTTPRequestcan be used in asynchronious mode as well.P.S. I did not tested the code, but it should work.
To post form data you can use
ASIFormDataRequest, documentation is here