I am using AFNetworking to perform login and the url format is like this:
http://xxx/mobile?function=login&req={username:xxx,password:xxx}
So firstly I created the parameters using a NSDictionary within a NSDictionary, like below:
@{@"function" : @"login",
@"req" : @{@"username" : @"xxx", @"password" : @"xxx"}}
But the query comes out is wrong
function=login&req[password]=xxx&req[username]=xxx
After this, I used JSONKit to package the parameter
NSDictionary *userInfo = @{@"userName" : [username URLEncodedString],
@"password" : [password URLEncodedString]};
NSDictionary *parameters = @{@"function" : @"login",
@"req" : [userInfo JSONString]};
And the results seem alike but "{}" encoded
function=login&req=%7B%22userName%22%3A%22xxx%22%2C%22password%22%3A%22xxx%22%7D
Where did I goes wrong? How can I correct it? Many Thanks!