Alamofire NSURLErrorDomain code=-999 cancelled

385 views Asked by At

I am using Alamofire to get information from an API. My problem is that when I call a specific API method, it doesn't returns nothing, I only get the error inputDataNilOrZeroLength. After investigating I get the next error in the profile: NSURLErrorDomain code=-999 cancelled. That only happens with this API method, but it works in Postman or in Android and also the rest of the API methods work. I checked that the session or the class that have the call is not deinit during the run.

Here is some of my code that is affected:

func apiMethodDontWork() -> Single<[MyCustomObject]> {
        let path = "hereIsMyUrl"
   
           return self.sessionManager.request(.get, path).validate(statusCode:200..<300)
            .responseData()
                .do(onNext: { requestData in
                    print("Error in the request: \(requestData)" )
                }).expectingFamilyObject(ofFamily: MyCustomObject.self).asSingle()
                    
    }
open func initialLoad() -> Completable {
//All the methods called below call the api and handle the data to return a completable
        return self.getVersions().andThen(Completable.zip(
            self.callApiMethodDontWork(), callApiMethosWork1(), callApiMethosWork2(),callApiMethosWork3()
        ))
        
    }

iOS version is 13.0 Alamofire version 5.4.4 RxAlamofire version 6.1.1

0

There are 0 answers