I have tried many methods of posting data to server but none of them worked and only response am getting is:
{\"Message\":\"An error has occurred.\"}
BASE_URL = PASS_YOUR_URL _params = parameters // AS NSMutableDictionary Try this.
NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
[params setValue:YOUR_VALUE forKey:@"cust_id"]; // here pass your field that you want to pass as parameter.
[params setValue:YOUR_VALUE forKey:@"Prod_ID"];
NSString *url = [BASE_URL stringByAppendingString:_action];
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:[NSURL URLWithString:url]];
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
[manager POST:url parameters:_params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSLog(@"response = %@", responseObject);
if( _success )
{
_success( responseObject ) ;
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"error = %@", error);
if( _failure )
{
_failure( error) ;
}
}];