2

I have in my app check with Reachability check, but in one device in 4G its return me a NotReachable even the iPhone get Facebook messages and whatsapp.

if the iPhone in wifi this work grate.

what can be the problem ?

-(BOOL)isConnectedToInternet {
Reachability *networkReachability = [Reachability reachabilityWithHostName:HOST_NAME];
NetworkStatus networkStatus = [networkReachability currentReachabilityStatus];
return networkStatus != NotReachable;
}
user6788419
  • 7,196
  • 1
  • 16
  • 28
Roei Nadam
  • 1,780
  • 1
  • 15
  • 33
  • 1
    I don't know the Reachability framework. I can recommand using AFNetworking / AFNetworkReachabilityManager. I never had any problem with it and I know for a fact, that it is reliable – Marco Jan 26 '17 at 07:21
  • 1
    Please check in settings that, is mobile data on for your app – user6788419 Jan 26 '17 at 07:29
  • 1
    thanks I try now AFNetworking and when the user response me I update here. – Roei Nadam Jan 26 '17 at 07:47
  • ya same issue with Reachability but you can use default SCNetworkReachability provided by systemconfiguration framework. If you want method I can post my answer with this default method. – Jitendra Modi Jan 26 '17 at 09:25
  • Reachability is just sample code which wraps `SCNetworkReachability` in ObjC code. – Avi Jan 26 '17 at 12:01

1 Answers1

3

I have always had problems with Reachability. I tend not to use it now and just make the network call. AFNetworking will fail with an NSError with code kCFURLErrorNotConnectedToInternet (-1009) if there's no network.

norders
  • 1,160
  • 9
  • 13