-
Notifications
You must be signed in to change notification settings - Fork 1
/
RFNetworkKit.h
66 lines (50 loc) · 1.3 KB
/
RFNetworkKit.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// RFNetworkKit.h
// RF
//
// Created by gouzhehua on 14-6-26.
// Copyright (c) 2014年 GZH. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "ARCMacros.h"
#import "Reachability.h"
@class RFNetworkKit;
@protocol RFNetworkStatusChangeDelegate <NSObject>
- (void)onNetworkStatusChanged:(RFNetworkKit *)aKit;
@end
@interface RFNetworkKit : NSObject
{
BOOL canUse3G;
BOOL canUseWifi;
BOOL has3G;
BOOL hasWifi;
BOOL isOnlyUseOnWifi;
NetworkStatus lastNetworkStatus;
}
@property (nonatomic, SAFE_ARC_WEAK) id<RFNetworkStatusChangeDelegate> delegate;
+ (RFNetworkKit *)shared;
// 注册检查网络
- (void)startCheck;
// 是否连接网络(isOnlyUseOnWifi参与影响)
- (BOOL)isConnect;
// 是否脱机
- (BOOL)isOffline;
// 上一次联网状态
- (NetworkStatus)lastNetworkStatus;
// 设置程序内是否允许通过3G访问网络
- (void)use3G:(BOOL)bUse;
// 若3G访问网络允许,返回YES;否则返回NO
- (BOOL)canUse3G;
// 设置程序内是否允许通过wifi访问网络
- (void)useWifi:(BOOL)bUse;
// 若wifi访问网络允许,返回YES;否则返回NO
- (BOOL)canUseWifi;
// 实际在线网络状态
- (BOOL)hasNetWork;
- (BOOL)has3G;
- (BOOL)hasWifi;
//只在wifi下使用
- (void)setIsOnlyUseOnWifi:(BOOL)bValue;
- (BOOL)isOnlyUseOnWifi;
@end