ios - Posting JSON data using AFNetworking 2.0 -


i have web script accepts json string input through http post request. have came across several afnetworking 1.x example same , can please point me or give afnetworking 2.0 example http post request web script formatted json input ?

thanks

after searching docs , trying out codes got following example

 afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; manager.requestserializer = [afjsonrequestserializer serializer];   nsdictionary *params = @ {@"user" :txtusername, @"pwd" :txtpwd };   [manager post:url_signin parameters:params success:^(afhttprequestoperation *operation, id responseobject) {     nslog(@"json: %@", responseobject); } failure:  ^(afhttprequestoperation *operation, nserror *error) {      nslog(@"error: %@", error);  }]; 

also don't forget set response header type in server script application/json.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -