// 0:无网络 1:2g 2:3g 3:4g 5:wifi
+(NSInteger)getNetWorkInfo{
UIApplication *app=[UIApplicationsharedApplication];
NSArray *children = [[[app valueForKeyPath:@"statusBar"] valueForKeyPath:@"foregroundView"] subviews];
int type =0;
for (id child in children) {
if ([child isKindOfClass:NSClassFromString(@"UIStatusBarDataNetworkItemView")]) {
type = [[child valueForKeyPath:@"dataNetworkType"] intValue];
}
}
//
// NSLog(@"----%d", type);
return type;
}