I want to send JSON data in URL body from my IOS app to server.I searched many SO question but i can't find what i want. If anyone knows how to do with AFNetworking then please let me know.Thanks This is my code snipped which send parameters
NSMutableDictionary *parameters = [[NSMutableDictionary alloc]init];
[parameters setValue:@"PY" forKey:@"AppSecret"];
[parameters setValue:@"IOS" forKey:@"login_provider"];
[parameters setValue:_txtemail.text forKey:@"email"];
[parameters setValue:_txtpassword.text forKey:@"password"];
[parameters setValue:@"1" forKey:@"ios_device_id"];
AFHTTPSessionManager *managertwo = [[AFHTTPSessionManager alloc]initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
managertwo.requestSerializer = [AFJSONRequestSerializer serializer];
[managertwo.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[managertwo POST:[NSString stringWithFormat:@"http://capemedics.co.za/Api/user_register/valid_user"] parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSLog(@"success! %@",responseObject);
NSLog(@"%@",parameters);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"error: %@", error);
}];
And i am getting error in it. I want to pass JSON data like this in URL Body
{"login_provider": "IOS","email": "%@","password": ”%@“,”ios_device_id": "1"}
Try This