...
|
...
|
@@ -20,43 +20,41 @@ |
|
|
+(void)startTrack{
|
|
|
static dispatch_once_t onceToken;
|
|
|
dispatch_once(&onceToken, ^{
|
|
|
static dispatch_once_t onceToken;
|
|
|
dispatch_once(&onceToken, ^{
|
|
|
@try {
|
|
|
NSError *viewdidloadError = NULL;
|
|
|
[[self class] yh_swizzleMethod:@selector(viewDidLoad)
|
|
|
withMethod:@selector(yher_viewDidLoad)
|
|
|
error:&viewdidloadError];
|
|
|
if (viewdidloadError) {
|
|
|
YHLog(@"Failed to swizzle viewDidLoad: on UIViewController. Details: %@", viewdidloadError);
|
|
|
viewdidloadError = NULL;
|
|
|
}
|
|
|
|
|
|
NSError *viewdidappearError = NULL;
|
|
|
[[self class] yh_swizzleMethod:@selector(viewDidAppear:)
|
|
|
withMethod:@selector(yher_viewDidAppear:)
|
|
|
error:&viewdidappearError];
|
|
|
if (viewdidappearError) {
|
|
|
YHLog(@"Failed to swizzle viewDidAppear: on UIViewController. Details: %@", viewdidappearError);
|
|
|
viewdidappearError = NULL;
|
|
|
}
|
|
|
|
|
|
} @catch (NSException *exception) {
|
|
|
YHLog(@"%@ error: %@", self, exception);
|
|
|
@try {
|
|
|
NSError *viewdidloadError = NULL;
|
|
|
[[self class] yh_swizzleMethod:@selector(viewDidLoad)
|
|
|
withMethod:@selector(yher_viewDidLoad)
|
|
|
error:&viewdidloadError];
|
|
|
if (viewdidloadError) {
|
|
|
YHLog(@"Failed to swizzle viewDidLoad: on UIViewController. Details: %@", viewdidloadError);
|
|
|
viewdidloadError = NULL;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
NSError *viewdidappearError = NULL;
|
|
|
[[self class] yh_swizzleMethod:@selector(viewDidAppear:)
|
|
|
withMethod:@selector(yher_viewDidAppear:)
|
|
|
error:&viewdidappearError];
|
|
|
if (viewdidappearError) {
|
|
|
YHLog(@"Failed to swizzle viewDidAppear: on UIViewController. Details: %@", viewdidappearError);
|
|
|
viewdidappearError = NULL;
|
|
|
}
|
|
|
|
|
|
} @catch (NSException *exception) {
|
|
|
YHLog(@"%@ error: %@", self, exception);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
- (void)yher_viewDidLoad{
|
|
|
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && ![[YHEventReport sharedInstance] isPerformanceViewControllerStringIgnored:NSStringFromClass([self class])]) {
|
|
|
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].isControllerPerformanceTrackEnable && ![[YHEventReport sharedInstance] isPerformanceViewControllerStringIgnored:NSStringFromClass([self class])]) {
|
|
|
[[YH_EventCollector sharedInstance] timeEventStartWithViewController:self];
|
|
|
}
|
|
|
[self yher_viewDidLoad];
|
|
|
}
|
|
|
|
|
|
-(void)yher_viewDidAppear:(BOOL)animated {
|
|
|
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && ![[YHEventReport sharedInstance] isPerformanceViewControllerStringIgnored:NSStringFromClass([self class])]) {
|
|
|
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].isControllerPerformanceTrackEnable && ![[YHEventReport sharedInstance] isPerformanceViewControllerStringIgnored:NSStringFromClass([self class])]) {
|
|
|
[[YH_EventCollector sharedInstance] timeEventEndWithViewController:self];
|
|
|
}
|
|
|
[self yher_viewDidAppear:animated];
|
...
|
...
|
|