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}};
requestSerializer
is[AFHTTPRequestSerializer serializer]
. If you server is designed to receive JSON requests, you wantmanager.requestSerializer = [AFJSONRequestSerializer serializer]
. – Oxley@"identifier": @"calendar-mobile"
should be in a dictionary that is@{@"application" : @{@"identifier": @"calendar-mobile"}}
- if you post your code in the question rather than just the JSON people might be able to help – Perusse