There are many ways to determine how a network is connected in iOS, mostly by joining the Open Source Library and then judging by the methods available in the open Source Library.
Here's a way to do it: lots of advice
Nsarray *subviews = [[[[UIApplication sharedapplication] Valueforkey:@"StatusBar"] Valueforkey:@"Foregroundview"] subviews]; NSNumber*datanetworkitemview =Nil; for(IDSubviewinchsubviews) { if([Subview iskindofclass:[nsclassfromstring (@"Uistatusbardatanetworkitemview")class]]) {Datanetworkitemview=Subview; Break; } } Switch([[Datanetworkitemview Valueforkey:@"Datanetworktype"] IntegerValue]) { Case 0: //NSLog (@ "No WiFi or Cellular"); Break; Case 1: //NSLog (@ "2G"); return @"2G"; Break; Case 2: //NSLog (@ "3G"); return @"3G"; Break; Case 3: //NSLog (@ "4G"); return @"4G"; Break; Case 4: //NSLog (@ "LTE"); return @"LTE"; Break; Case 5: //NSLog (@ "Wifi"); return @"WiFi"; Break; default: Break; }
How iOS determines network connectivity