Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)loginComplete:(NSMutableDictionary *)logInfo
- {
- appDelegate= (AppDelegate *) [[UIApplication sharedApplication]delegate];
- [SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeGradient];
- //NSUserDefaults *prefs =[NSUserDefaults standardUserDefaults];
- NSString *loginUrl = [NSString stringWithFormat:@"%@user/log_in_mobile/", BaseURLString_development];
- NSLog(@"url %@",loginUrl);
- AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
- // manager.requestSerializer = [AFJSONRequestSerializer serializer];
- // [manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
- // [manager.requestSerializer setValue:@"iOS" forHTTPHeaderField:@"platform"];
- // [manager.requestSerializer setValue:@"1.0.0" forHTTPHeaderField:@"version"];
- [manager POST:loginUrl parameters:@{
- @"phone_no": [logInfo valueForKey:@"userID"],
- @"pin": [logInfo valueForKey:@"pin"],
- @"ip_address": [logInfo valueForKey:@"Ip"],
- @"login_lat": [logInfo valueForKey:@"latitude"],
- @"login_lng": [logInfo valueForKey:@"longitude"],
- @"login_type": @"mobile"
- } success:^(AFHTTPRequestOperation *operation, id responseObject)
- {
- NSDictionary *jsondict=responseObject;
- // [SVProgressHUD dismiss];
- // if (![jsondict isKindOfClass:[NSNull class]])
- // {
- // NSLog(@"userinfo %@",jsondict);
- // if ([[jsondict valueForKey:@"statusCode"]integerValue]==200)
- // {
- //
- // }
- // else
- // {
- // NSLog(@"Message: %@",[jsondict valueForKey:@"Message"]);
- // UIAlertController *alert = [UIAlertController
- // alertControllerWithTitle:@"Alert"
- // message:[jsondict valueForKey:@"Message"]
- // preferredStyle:UIAlertControllerStyleAlert];
- //
- // UIAlertAction* DismissButton = [UIAlertAction
- // actionWithTitle:@"OK"
- // style:UIAlertActionStyleDefault
- // handler:^(UIAlertAction * action) {
- // [alert dismissViewControllerAnimated:YES completion:nil];
- // }];
- //
- // [alert addAction:DismissButton];
- //
- // [[[[[UIApplication sharedApplication] delegate] window] rootViewController] presentViewController:alert animated:YES completion:nil];
- // }
- // }
- // else
- // {
- // UIAlertController *alert = [UIAlertController
- // alertControllerWithTitle:@"Alert"
- // message:@"Data Not Found."
- // preferredStyle:UIAlertControllerStyleAlert];
- //
- // UIAlertAction* DismissButton = [UIAlertAction
- // actionWithTitle:@"OK"
- // style:UIAlertActionStyleDefault
- // handler:^(UIAlertAction * action) {
- // [alert dismissViewControllerAnimated:YES completion:nil];
- // }];
- //
- // [alert addAction:DismissButton];
- // [[[[[UIApplication sharedApplication] delegate] window] rootViewController] presentViewController:alert animated:YES completion:nil];
- // }
- } failure:^(AFHTTPRequestOperation *operation, NSError *error)
- {
- [SVProgressHUD dismiss];
- UIAlertController *alert = [UIAlertController
- alertControllerWithTitle:@"Alert"
- message:@"Connecting Error"
- preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction* DismissButton = [UIAlertAction
- actionWithTitle:@"OK"
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction * action) {
- [alert dismissViewControllerAnimated:YES completion:nil];
- }];
- [alert addAction:DismissButton];
- [[[[[UIApplication sharedApplication] delegate] window] rootViewController] presentViewController:alert animated:YES completion:nil];
- }];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement