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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -