iphone - How to detect network type i.e. 3G/4G? -


this question has answer here:

i working on application call web services using wifi cellular data of iphone. application working fine on wifi , 3g network not working in 4g network. please tell me how detect whether app connected through 3g or 4g , how resolve problem related 4g network.

any appreciable. in advance.

here same issue , may bellow code of example helps you. using private apis, can read information directly in status bar.

https://github.com/nst/mobilesignal/blob/master/classes/uiapplication+ms.m

+ (nsnumber *)datanetworktypefromstatusbar {      uiapplication *app = [uiapplication sharedapplication];      uistatusbar *statusbar = [app valueforkey:@"statusbar"];      uistatusbarforegroundview *foregroundview = [statusbar valueforkey:@"foregroundview"];      nsarray *subviews = [foregroundview subviews];      uistatusbardatanetworkitemview *datanetworkitemview = nil;      (id subview in subviews) {         if([subview iskindofclass:[nsclassfromstring(@"uistatusbardatanetworkitemview") class]]) {             datanetworkitemview = subview;             break;         }     }      return [datanetworkitemview valueforkey:@"datanetworktype"]; } 

credit goes :-

determining 3g vs edge

objective-c determine data network type of ios device


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -