1
votes

I get this from a request in my app, but i go to my url in safari and the url works fine.

this is my request

Alamofire.request("my url").responseJSON { response in

        print(response)

        if let JSON = response.result.value {
            print("JSON: \(JSON)")
        }
    }

and this is the response

Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={NSUnderlyingError=0x60800024dce0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={_kCFStreamErrorCodeKey=54, _kCFStreamErrorDomainKey=1}}, NSErrorFailingURLStringKey= my url, NSErrorFailingURLKey=my url, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=54, NSLocalizedDescription=The network connection was lost.}

I trying reset the simulator, reset my Mac, and all this tricks for bugs. but nothing solve my problem. any help?

1
Do you have Allow Arbitrary Loads property set to YES?Mo Abdul-Hameed
Yes is set to yes!steibour

1 Answers

0
votes

I had a very similar problem using the iPhone simulator to run an Alamofire call in a cafe that had a open wifi network that had a "Accept and Connect" screen (a la Starbucks) to connect. Public was very slow and overburdened with traffic, hence I think it may have been timing out. I ran through tons of trouble shooting to no avail and finally I just moved to my wifi network at home and things work fine now with no changes.

Not so sure that's the trouble you are having as it's pretty specific, but perhaps this can add to the scope of what you've been troubleshooting :)