I need the pros here to enlighten me on what's wrong with my code. I'm trying to migrate from 2.x to 3.x and I'm getting a migraine.
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
NSDictionary *parameters = @{@"email": email, @"password": password};
[manager POST:urlString parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSString *responseStr = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
NSData *jsonData = [responseStr dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonData
options:0
error:nil];
if ([[json objectForKey:@"success"] intValue] != 1) {
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"" message:self.error_login delegate:nil cancelButtonTitle:self.continueButton otherButtonTitles:nil];
[MBProgressHUD hideHUDForView:self.view animated:YES];
[alert show];
} else {
[MBProgressHUD hideHUDForView:self.view animated:YES];
AccountViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"account"];
NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:[[self navigationController] viewControllers]];
[viewControllers removeLastObject];
[viewControllers addObject:vc];
[[self navigationController] setViewControllers:viewControllers animated:NO];
}
} failure:^(NSURLSessionDataTask *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
The server side keeps showing that the parameters are empty.
Any guidance would be greatly appreciated =D