記錄自用
[DYViewController aspect_hookSelector:@selector(viewDidAppear:)
withOptions:AspectPositionAfter
usingBlock:^(id<AspectInfo> info){
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSArray *pageArray = [self page];
for (NSDictionary *dict in pageArray) {
BOOL isSwitch = [dict jk_boolForKey:@"switch"];
if (!isSwitch) {
return;
}
NSString *className = [dict jk_stringForKey:@"className"];
NSString *pageName = [dict jk_stringForKey:@"pageName"];
if ([className isEqualToString:[info.instance className]]) {
NSLog(@"[統(tǒng)計]-viewDidAppear:%@", pageName);
[MobClick beginLogPageView:pageName];
}
}
});
}
error:NULL];
[DYViewController aspect_hookSelector:@selector(viewDidDisappear:)
withOptions:AspectPositionAfter
usingBlock:^(id<AspectInfo> info) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSArray *pageArray = [self page];
for (NSDictionary *dict in pageArray) {
BOOL isSwitch = [dict jk_boolForKey:@"switch"];
if (!isSwitch) {
return;
}
NSString *className = [dict jk_stringForKey:@"className"];
NSString *pageName = [dict jk_stringForKey:@"pageName"];
if ([className isEqualToString:[info.instance className]]) {
NSLog(@"[統(tǒng)計]-viewDidDisappear:%@", pageName);
[MobClick endLogPageView:pageName];
}
}
});
}
error:NULL];