I am using AFnetworking library to post data on server.
Following is my code to post data on server.
- (void) callLoginAPI:(NSDictionary *)dictProfil
The error says it all: you got a 400 response from the server, meaning that what you sent was either not formatted properly, or the server just couldn't understand it.
Please add this line to your code, i hope it help you.
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
I had experienced the same issue. In my case its only for upload Image with larger size. Our server has limited with max.upload size. I resized the image and uploaded, and the issue is gone.
You can resize the image with:
+ (UIImage*)imageWithImage:(UIImage*)image
scaledToSize:(CGSize)newSize;
{
UIGraphicsBeginImageContext( newSize );
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}