3

I am using Reachability to handle internet connection. Whenever the internet is not connected i show the alert of not connected to internet.

However, when the internet speed is slow and when pulling the data from API takes more than 10 seconds, i need to show the message to the user that it has slow internet connectivity.

Rupesh Jaiswal
  • 93
  • 1
  • 1
  • 9
  • 2
    I think you can do it with request time out. when request time out occur you can got specific error code so at that time you can show slow internet speed dialog – Chirag Shah Feb 23 '17 at 06:00

1 Answers1

0

I think you need to increase the time interval of specific request where you are not receiving response with in timeline. If you are using Alamofire you can Increase time out interval by following.

Swift 3

let manager = Alamofire.SessionManager.default
manager.session.configuration.timeoutIntervalForRequest = 120

manager.request("yourUrl", method: .post, parameters: ["parameterKey": "value"])

Also in error call back you will receive

switch response.result {
            case .success:

                 // Successfull API Response

            case .failure(let error):
                errorHandler(error)
                print(error.localizedDescription)

                if let error = error as? NSError {
                    print(error.code) // this will print error code                      
                }
  }

Let me know if you require any more help.

Anil Kukadeja
  • 1,348
  • 1
  • 14
  • 27