Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: bad request (400)

前端 未结 3 1750
春和景丽
春和景丽 2021-01-12 17:54

I am using AFnetworking library to post data on server.

Following is my code to post data on server.

- (void) callLoginAPI:(NSDictionary *)dictProfil         


        
3条回答
  •  太阳男子
    2021-01-12 18:18

    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;
    }
    

提交回复
热议问题