title: AFNetwoking with swift 3.0 & xcode 8 : POST Request & GET Request
body: <p>I am trying to parse data using AFNetworking &amp; swift 3.0 and xcode 8.0 but i am getting error like below.below code works fine for swift 2.3 but not working in 3.0</p>
  
  <p><strong>Or if is there anyone know about AFNetworking &amp; swift 3.0 using xcode 8.0 for POST &amp; GET request please tell me. with simple example.
  Thanks in Advance</strong></p>
  
  <p>You can see below error.</p>
  
  <p><a href="https://i.stack.imgur.com/pNYbx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pNYbx.png" alt="enter image description here"></a></p>
  
  <pre><code> func callApi(apiName: String, param: [String : AnyObject]?, data: NSDictionary?, withMethod type: String, CompletionHandler:@escaping (_ code: Int, _ error:NSError?, _ response:AnyObject?) -&gt; Void)
  
      {
  
          MBProgressHUD.showAdded(to: AppDelegateObj.window, animated: true)
          let str_URL : String = kHOSTPATH+apiName
  
          let manager: AFHTTPSessionManager = AFHTTPSessionManager()
  
          if (type == kREQ_POST) {
  
              manager.POST(str_URL, parameters: param, constructingBodyWithBlock: { (formData: AFMultipartFormData!) in
  
                  if data?.allValues.count != 0 &amp;&amp; data != nil
                  {
  
                      let fileUrl = NSURL(fileURLWithPath: (data?.valueForKey("filePath"))! as! String)
                      try! formData.appendPartWithFileURL(fileUrl, name: (data?.valueForKey("key"))! as! String)
                  }
  
                  }, progress: { (NSProgress) in
  
                  }, success: { (task:URLSessionDataTask, responseObject) -&gt; Void in
  
                      CompletionHandler(code: 1, error: nil, response:responseObject)
                      MBProgressHUD.hideHUDForView(AppDelegateObj.window, animated: true)
  
                  }, failure: { (task:URLSessionDataTask?, error:NSError) -&gt; Void in
  
                      CompletionHandler(code: 0, error: error, response:nil)
                      MBProgressHUD.hideHUDForView(AppDelegateObj.window, animated: true)
              })
          }
          else {
  
              manager.GET(str_URL, parameters: param, progress: { (NSProgress) in
  
                  }, success: { (task:URLSessionDataTask, responseObject) -&gt; Void  in
  
                      CompletionHandler(code: 1, error: nil, response:responseObject)
                      MBProgressHUD.hideHUDForView(AppDelegateObj.window, animated: true)
  
                  }, failure: { (task:URLSessionDataTask?, error:NSError) -&gt; Void  in
  
                      CompletionHandler(code: 0, error: error, response:nil)
                      MBProgressHUD.hideHUDForView(AppDelegateObj.window, animated: true)
              })
          }
      }
  </code></pre>
  
  <p>but i am getting error like this </p>
  
  <pre><code>cannot convert the value of type (URLSessionDataTask?,NSError)-&gt;Void to expected argument type '((URLSessionDataTask?,NSError)-&gt;Void)?'
  </code></pre>