iphone - How to detect network type i.e. 3G/4G? -
this question has answer here:
- determining 3g vs edge 5 answers
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 :-
Comments
Post a Comment