I have added Reachability classes provided by apple and it is working fine for checking internet connection. MY app is displaying message if internet goes off.
But if in
You can send a request to your server and given that it's about 5-10 KB of data you expect to be returned, then create a timer callback that is scheduled for say 20 seconds.
If you don't get a response within 20 seconds, then let's consider that a slow connection.
Example:
// make POST request to server, the POST request should have a callback method assigned
[self testSpeed];
// schedule a method to be called after 20 seconds
myTimer = [NSTimer scheduledTimerWithInterval:20.0 selector:@selector(stopSpeedTest) .... ];
// your POST request callback method
-(void)speedTestCallback
{
[myTimer invalidate];
myTimer = nil;
[self alertGoodSpeed];
}
// your stopSpeedTest method to identify app didn't receive response within 20 seconds
-(void)stopSpeedTest
{
[self alertTooSlow];
}
I think that's what H2CO3 was trying to ask:
"How many bytes per second do you consider slow?"
You need to decided on long you think the user is willing to wait for the amount of data expected to be returned.
If you're telling the user you're downloading 50 MB of data, then yes, getting them all back in 20 second is fast.
However, if you're expecting only 5-10 KB of data and it's taking longer than 10 seconds, let alone 20 seconds, then connection is very slow.