0

I m working on an iOS project with swift and Alamofire and I m getting a weird message when I m trying tot do post a request. The weird part is that for get request is working fine.

CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
class = inet;
"m_Limit" = "m_LimitAll";
ptcl = htps;
"r_Attributes" = 1;
sdmn = Application;
srvr = "www.***.com";
sync = syna;}

I m not sure what it means.

Alamofire.request(
       path,
       method: .post
      ).responseJSON { response in

                switch response.result {
                    case .success(let data):
                        let json = JSON(data)
                        print(json)
                       
                    case .failure(let err):
                        SVProgressHUD.dismiss()
                        print(err)
                    }

                }

We are using Ruby on Rails for the backend and the returned json is always:

{ "error" : "" }

Also in the Rails rest controller we are using before_action :authenticate_user!. If I remove this service from the controller is working fine but we need it. Also I've tried with the local server and with the server on a remote host but same results.

I also found this post that talks about the same error CredStore Perform Query error but we dont use username and password authentication for this app.

Another approach was to set the cookies from the login manually with Alamofire SessionManager but it did not helped.

lazy var sessionManager: SessionManager = {
        
            let cookies = HTTPCookieStorage.shared.cookies
            let configuration = URLSessionConfiguration.default
            configuration.httpAdditionalHeaders = HTTPCookie.requestHeaderFields(with: cookies ?? [])
            configuration.urlCredentialStorage = nil

            let manager = Alamofire.SessionManager(configuration: configuration)
               
            return manager
    }()

1 Answers1

0

This error is produced by the operating system checking to see if there are any credentials associated with your domain, as Alamofire implements the relevant URLSession delegate method, and does not affect request completion. You can ignore it.

Jon Shier
  • 12,200
  • 3
  • 35
  • 37
  • Not really, I can't igonre this problem because the response body is not what I need. The server returns {error: ""}, not the json I need. Also the status code is 401. – DenisuDevForFood Jan 21 '21 at 12:14
  • If you actually need to use a credential, use the `authenticate()` method with the appropriate credentials, or add the appropriate header. – Jon Shier Jan 21 '21 at 15:32