⽹络监听万能代码
NSUrDefaults * defaults = [NSUrDefaults standardUrDefaults];
//根据不同的⽹络状态改变去做相应处理广西二本学校
[[AFNetworkReachabilityManager sharedManager]
tReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
[defaults tObject:[NSNumber numberWithInteger:status]forKey:@"network"];
switch (status) {
ca AFNetworkReachabilityStatusReachableViaWWAN:
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"当前⽹络2g/3g/4g连接" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
[alert relea];
牛肉炒土豆的做法
}
break;
ca AFNetworkReachabilityStatusReachableViaWiFi:
虎7{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"当前⽹络wifi连接" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
[alert relea];
}
mergedbreak;
ca AFNetworkReachabilityStatusNotReachable:
{
课间十分钟教案
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"当前⽹络不可⽤,请检查⽹络" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
[alert relea];
笔记本加装内存条}
break;
顶天立地是什么意思default:
break;
}
}];
//开始监控
开奶茶店流程
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
lf.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelea];