I am using AFNetworking
2.0.
In AFNetworking
, AFHTTPRequestOperationManager
object has an API:
(AFHTTPRequestOperation *)POST:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
It accepts NSDictionary as params for the JSON Payload which we wish to 'POST' to the server. In my payload I have following key-value pair:
"buttonActionParam":"/catalog/special/international-calling"
Posting this payload server returns invalid JSON. Looking at the payload on the server side I realized that AFNetworking is actually sending:
"buttonActionParam":"\/catalog\/special\/international-calling".
I know that AFNetworking
library uses NSJSONSerialization
's class method -dataWithJSONObject:
, which causes this. My question is:
Q. How to work around this issue?