2

I'm using iOS4.1 on an iPhone4. I'm also using the latest version of the Reachability code. My device doesn't have a connection but it seems like the code waits to timeout or else the device takes ages to report back about the reachability status.

this doesn't seem to happen on iOS4.0.1 using iPhone3gs.

Has anyone else come across this? Any way to get around it other than starting a new thread?

Peter DeWeese
  • 18,141
  • 8
  • 79
  • 101
Remover
  • 1,616
  • 1
  • 17
  • 27

1 Answers1

7

Are you sure you're using it asynchronously?

From Apple's docs ReadMe.txt on the Reachability project:

The Reachability sample demonstrates the asynchronous use of the SCNetworkReachability API. You can use the API synchronously, but do not issue a synchronous check by hostName on the main thread. If the device cannot reach a DNS server or is on a slow network, a synchronous call to the SCNetworkReachabilityGetFlags function can block for up to 30 seconds trying to resolve the hostName. If this happens on the main thread, the application watchdog will kill the application after 20 seconds of inactivity.

So, I think you're right - start a background thread to handle it.

makdad
  • 6,402
  • 3
  • 31
  • 56
  • thanks for responding. i decided that the best thing was just to take the reachability out of the app all together. for my purposes the app logic was good enough. so basically, i can't decide on a the right answer here. cheers. – Remover Jan 09 '11 at 17:28