title: AFNetworking 2.0 update on an existing project
body: <p>I recently updated my project to 2.0 of AFNetworking and it appears that the AFHTTPClient file is missing. </p>
  
  <p>I read the following at: <a href="https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-2.0-Migration-Guide" rel="nofollow">https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-2.0-Migration-Guide</a></p>
  
  <p>It appears i will now have to use AFHTTPRequestOperation ?</p>
  
  <p>If so how can I modify the following piece of code to the new AFHTTPRequestOperation?</p>
  
  <pre><code>NSURL *url = [NSURL URLWithString:WEB_SERVICE_BASE_URL];
  
          AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:url];
          [client registerHTTPOperationClass:[AFJSONRequestOperation class]];
          [client setDefaultHeader:@"Accept" value:@"application/json"];
          [client postPath:LOGIN_PATH parameters:[NSDictionary dictionaryWithObjectsAndKeys:self.userNameOrEmail.text ,@"userNameOrEmail",self.password.text,@"password", nil]
                   success:^(AFHTTPRequestOperation *operation, id responseObject) 
           {
               bool success = [[responseObject valueForKeyPath:@"success"] boolValue];
               NSString *displayMessage = [responseObject valueForKeyPath:@"displaymessage"];
  
               if (success) {
                   NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
                   [defaults setObject:self.userNameOrEmail.text forKey:@"userNameOrEmail"];
                   [defaults setObject:self.password.text forKey:@"password"];
  
    //              [Flurry setUserID:self.userNameOrEmail.text];
                   [SVProgressHUD showSuccessWithStatus:displayMessage];
                  [self dismissViewControllerAnimated:YES completion:nil];
               } else {
                   [SVProgressHUD showErrorWithStatus:displayMessage];
               }    
           } 
                   failure:^(AFHTTPRequestOperation *operation, NSError *error) 
           {
  
               NSLog(@"error is: %@", error);
  
               [SVProgressHUD showErrorWithStatus:MSG_SERVER_ERROR];
           }];
  </code></pre>
  
  <p>UPDATE: I did the following:</p>
  
  <pre><code>AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
          NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:self.userName.text ,@"user", self.email.text, @"email",self.password.text,@"password", nil];
          [manager POST:WEB_SERVICE_BASE_URL parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
              bool success = [[responseObject valueForKeyPath:@"success"] boolValue]? @"YES" : @"NO";
  
              NSString *displayMessage = [responseObject valueForKeyPath:@"displaymessage"];
  
              if (success) {
                  [SVProgressHUD showSuccessWithStatus:displayMessage];
                  [self.navigationController popToRootViewControllerAnimated:YES];
              } else {
                  [SVProgressHUD showErrorWithStatus:displayMessage];
              }
          } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
              [SVProgressHUD showErrorWithStatus:MSG_SERVER_ERROR];
          }];
  </code></pre>