how can I POST
JSON
parameters with AFNetworking
? Below is the example JSON
format. Thank you in advance.
{
"application": {
"identifier": "appDev"
},
"sso": {
"version": 2.0,
"session_expiry": 43200
},
"user": {
"password": "xxxx~!@",
"username": "xxx0min"
},
"coordinate": {
"latitude": 10.9948629,
"longitude": -169.5213749
}
}
I successfully created a JSON :
NSDictionary *parameters = @{@"application": @{@"identifier": @"appDev"}, @"sso": @{@"version": @"2.0", @"session_expiry":@43200}, @"user": @{@"password":@"xxxx~!@", @"username":@"xxx0min"}, @"coordinate": @{@"latitude":@10.9948629, @"longitude":@-169.5213749}};
Finally I found a solution to my problem. What I was doing is making NSDictionary of NSDictionary for my JSON parameters. Below is the full solution code.
First convert JSON string to NSDictionary:
Then you can send this dictionary with AFNetworking. In version 3 you should use AFHTTPSessionManager: