jamesBlake
jamesBlake

Reputation: 166

Alamofire Domain=NSPOSIXErrorDomain Code=2 error occurs after upgrade El Capitan with Xcode 7.0.1

I'm using Alamofire 2.0.1 (latest update) and SwiftyJSON for call rest api to my server. But today, after upgrade El Capitan and Xcode 7.0.1, suddenly "Alamofire Domain=NSPOSIXErrorDomain Code=2" <- error occurred . Some people have same issue like me, but that's all there was no answer for that.

Here is my code and it goes .Failure case and spit error.

I hope somebody solves this problem :(

Alamofire.request(.POST, "\(kServerUrl)/rest/report/createAccessLog", parameters: parameters, encoding: .JSON).responseJSON
            { _, _, result in
                switch result {
                case .Success(let data):
                    var json = JSON(data)
                    if let header = json["header"]["returnCode"].number where header==0 {
                    } else {
                    }
                case .Failure(_, let error):
                    print("something wrong with fetch createAccessLog \(error)")
                }
        }

Upvotes: 4

Views: 1805

Answers (1)

Leibniz
Leibniz

Reputation: 156

I have same problem,I have resolved it by apple release Notes. apple release Notes:When running in an iOS simulator for iOS versions 9.1 and earlier, an app may not communicate with TCP/IP services hosted locally by the Mac using the Mac’s local IP address. Connect via a loopback address, such as localhost or 127.0.0.1. (22453539).1 you just use 127.0.0.1 instead of Mac’s local IP address.

Upvotes: 1

Related Questions