Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline

Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline



i'm hiting an API in postman there i'm getting response fine. But when i hit same API in my iOS App its shows me nil response and result is error. I have printed the error,it shows me this, Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline. I have checked my internet connection it is working fine.I have searched different sites the internet connection if fine. But all the time it shows me this error. I'm confuse that why it is showing me this error. My code to hit api is this,


Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline.


class WalletDetailService

static let instance = WalletDetailService()
var getWalletDetailModelArray = [WalletDetail]()
var status:Int = 0

func getWalletDetails(param:[String : String],completion:@escaping CompletionHandler)
let header = [
"auth": "2dd7cfb3c40b4830b72be2cc90276fd9"
]

print(header)
let url = URL(string: getWalletDetailsUrl)

Alamofire.request(url!, method: .post, parameters: param, encoding: JSONEncoding.default, headers: header).responseJSON (response) in
print("Request: (String(describing: response.request))") // original url request
print("Response: (String(describing: response.response))") // http url response
print("Result: (response.result)")// response serialization result

if response.result.error == nil

guard let data = response.data else return
do
if let json = try JSON(data: data).dictionary
let result = json["result"]?.dictionary
let monthlyRental = result!["monthly_rental"]?.intValue
print(monthlyRental!)


completion(true)


completion(true)
catch let jsonErr
print(jsonErr)


else
completion(false)
debugPrint(response.result.error as Any)





}




0



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)