2

xcode 10.3 swift 4.2 iPhone app

I'm hitting a post type API to upload image along with some string data from a form. I'm getting response result as success but there is an error parameters which indicates: CredStore - performQuery - Error copying matching creds. Error=-25300

I have tried doing some research and found that I've problem with URLCredentialStorage but I don't have any Credentials in API. I looked at CredStore Perform Query error, I'm having very similar issue but can't find my solution there.

{
    let url = route.asURL(constants: constants)
    let parameters = route.asParameters(constants: constants)
    let headers: HTTPHeaders = [
        "authorization-name": APISession.token,
        "Content-Type": "multipart/form-data"
    ]

    Log(request: URLRequest(url: url))

    Alamofire.upload(multipartFormData: { (multipartFormData) in
        for (key, value) in parameters {                
            if let strValue = value as? String, let valueData = strValue.data(using: .utf8) {
                multipartFormData.append(valueData, withName: key)
            }

            if let imgValue = value as? UIImage, let imgData = imgValue.jpegData(compressionQuality: 0.5) {
                multipartFormData.append(imgData, withName: key, mimeType: "image/jpg")
            }
        }
    }, usingThreshold: UInt64.init(), to: url, method: .post, headers: headers) { (result) in
        print(result)
        switch result{
        case .success(let upload, _, _):
            upload.uploadProgress(closure: { (progress) in
                print("Preogress is: ", progress.fractionCompleted)
            })
            upload.responseJSON { response in
                print("Succesfully uploaded")
                switch response.result {
                case .success(let value):
                    print(value)
                case .failure(let error):
                    print(error)
                }
            }
        case .failure(let error):
            print("Error in upload: \(error.localizedDescription)")
        }
    }
}

I'm getting response like this,

success(request: 2019-08-12 13:07:04.224913-0400 project name[65508:460860] CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
    class = inet;
    "m_Limit" = "m_LimitAll";
    ptcl = htps;
    "r_Attributes" = 1;
    sdmn = "url";
    srvr = "url";
    sync = syna;
}

so I'm confused why I'm getting success response with error parameters in that.

BARS
  • 629
  • 1
  • 6
  • 18
  • I already visited https://stackoverflow.com/questions/46099940/credstore-perform-query-error but that didn't help me to understand issue and figure out any solutions. – BARS Aug 12 '19 at 17:27
  • What you've posted isn't from Alamofire, it's just system logging. What actual response do you get from the API you're uploading to? – Jon Shier Aug 13 '19 at 20:47
  • 1
    Did you solve this. If yes please give the brief – Shourob Datta Feb 22 '20 at 16:07

1 Answers1

0

Not sure but I think authorization-name key present in headers is incorrect. It should be Authorization.

Rachit Agarwal
  • 356
  • 2
  • 9
  • it's just place holder I put here because I don't want to disclose real authorization key. it's custom key set by our backend devops. – BARS Aug 28 '19 at 00:15