Error (Cocoa error 3840) (invalid value around character 0) in message with AFNetworking 2.0

I am using AFNetworking2.0 to call the API.

I am trying to send data to a web service using the method:

- (NSURLSessionDataTask *)POST:(NSString *)URLString
               parameters:(NSDictionary *)parameters
                  success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
                  failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure

Dictionary:

{
    uid = "B6ACB3EF-3E95-4313-9BC2-6FB47808D938";
}

get an error like:

Exception: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid value around character 0.) UserInfo=0xd0d7a10 {NSDebugDescription=Invalid value around character 0.}`

Thanks.

+4
source share
1 answer

Take a look at the response from the server. Perhaps he sends a bad answer. You can test it using Postman for Chrome or RESTClient for Firefox.

+1
source

All Articles