title: Refactoring afnetworking post request to 3.0
body: <p>I'm getting the warnings:</p>
  
  <p><code>Incompatible pointer types assigning to 'AFHTTPSessionManager *' from 'NSURLSessionDataTask * _Nullable'</code></p>
  
  <pre><code>'POST:parameters:success:failure:' is depreceated 
  </code></pre>
  
  <p>When trying to make a request with AFNetworking 3.0. I'm wondering what correct approach is to make a post request with AFNewtworking 3.0 for an app using iOS 7.0 or later. Here is my code: </p>
  
  <pre><code>    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
      [manager setResponseSerializer:[SignupResponseSerializer serializer]];
  
      __weak typeof(self)weakSelf = self;
  
      NSString *urlString = [NSString stringWithFormat:@"%s%s", kBaseURL, kRegisterURL];
  
      NSData *plainData = UIImagePNGRepresentation(self.profilePicture);
      NSString *base64String = [plainData base64EncodedStringWithOptions:0];
  
      if (self.firstNameField.text &amp;&amp; self.lastNameField.text &amp;&amp; self.passwordField.text &amp;&amp; self.emailField.text) {
          NSDictionary *params = @{ @"first_name": self.firstNameField.text, @"last_name": self.lastNameField.text, @"password": self.passwordField.text, @"email": self.emailField.text, @"avatar_data": base64String};
  
          self.sessionManager = [manager POST:urlString parameters:params success:^(NSURLSessionTask *task, id responseObject) {
              NSDictionary *JSON = [responseObject objectAtIndex:0];
              NSString *token = JSON[@"auth_token"];
              NSString *avatarURL = JSON[@"avatar_url"];
  
  
              weakSelf.credentialStore.avatarURL = avatarURL;
              weakSelf.credentialStore.authToken = token;
              weakSelf.credentialStore.firstName = self.firstNameField.text;
              weakSelf.credentialStore.lastName = self.lastNameField.text;
              weakSelf.credentialStore.email = self.emailField.text;
              weakSelf.credentialStore.password = self.passwordField.text;
  
              [SVProgressHUD dismiss];
              [self dismissViewControllerAnimated:YES completion:nil];
          } failure:^(NSURLSessionTask *task, NSError *error) {
  //            if (task.isCancelled) {
  //                return;
  //            }
              [SVProgressHUD showErrorWithStatus:@"Login Failed"];
              NSLog(@"%@", error);
          }];
      }
  </code></pre>