forked from summertian4/iOS-ObjectiveC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDMNetworkTrafficManager.m
More file actions
42 lines (32 loc) · 813 Bytes
/
Copy pathDMNetworkTrafficManager.m
File metadata and controls
42 lines (32 loc) · 813 Bytes
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
//
// DMNetworkTrafficManager.m
// DoggerMonitor
//
// Created by 周凌宇 on 2018/5/30.
//
#import "DMNetworkTrafficManager.h"
#import "DMURLProtocol.h"
@interface DMNetworkTrafficManager ()
@end
@implementation DMNetworkTrafficManager
#pragma mark - Public
+ (DMNetworkTrafficManager *)manager {
static DMNetworkTrafficManager *manager;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
manager=[[DMNetworkTrafficManager alloc] init];
});
return manager;
}
+ (void)startWithProtocolClasses:(NSArray *)protocolClasses {
[self manager].protocolClasses = protocolClasses;
[DMURLProtocol start];
}
+ (void)start {
[self manager].protocolClasses = @[[DMURLProtocol class]];
[DMURLProtocol start];
}
+ (void)end {
[DMURLProtocol end];
}
@end