Authored by 孙凯

修改 crash review by daiqiang

... ... @@ -18,10 +18,10 @@
29D3B9761F739D2F00B07F47 /* YH_EventCollector+UIAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D3B9751F739D2F00B07F47 /* YH_EventCollector+UIAlertView.m */; };
29D3B9791F739D8300B07F47 /* YH_EventCollector+PowerfulBannerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D3B9781F739D8300B07F47 /* YH_EventCollector+PowerfulBannerView.m */; };
29D3B97C1F73A81E00B07F47 /* YH_EventCollector+UIActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D3B97B1F73A81E00B07F47 /* YH_EventCollector+UIActionSheet.m */; };
52540FAD1F8F6BAD001907B3 /* YH_CrashReporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 52540FA91F8F6BAD001907B3 /* YH_CrashReporter.m */; };
52540FAE1F8F6BAD001907B3 /* YH_CrashDataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 52540FAC1F8F6BAD001907B3 /* YH_CrashDataManager.m */; };
29FB39AA1F7C9D67000E3B27 /* UIImageView+GestureAutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 29FB39A91F7C9D67000E3B27 /* UIImageView+GestureAutoTrack.m */; };
29FB39AD1F7C9D73000E3B27 /* UILabel+GestureAutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 29FB39AC1F7C9D73000E3B27 /* UILabel+GestureAutoTrack.m */; };
52540FAD1F8F6BAD001907B3 /* YH_CrashReporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 52540FA91F8F6BAD001907B3 /* YH_CrashReporter.m */; };
52540FAE1F8F6BAD001907B3 /* YH_CrashDataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 52540FAC1F8F6BAD001907B3 /* YH_CrashDataManager.m */; };
5255C2B91F5D25F400A8FC5F /* UICollectionView+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 5255C2A61F5D25F400A8FC5F /* UICollectionView+AutoTrack.m */; };
5255C2BA1F5D25F400A8FC5F /* UITableView+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 5255C2A81F5D25F400A8FC5F /* UITableView+AutoTrack.m */; };
5255C2BB1F5D25F400A8FC5F /* YHSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = 5255C2AA1F5D25F400A8FC5F /* YHSwizzle.m */; };
... ... @@ -52,8 +52,8 @@
B14C0C821F8DF22200D963F3 /* SDWebImageManager+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = B14C0C811F8DF22200D963F3 /* SDWebImageManager+AutoTrack.m */; };
B14C0C991F8E2E9B00D963F3 /* UITapGestureRecognizer+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = B14C0C981F8E2E9B00D963F3 /* UITapGestureRecognizer+AutoTrack.m */; };
B17F61DB1F6678CD009D1606 /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B17F61DA1F6678CD009D1606 /* UserNotifications.framework */; };
B1A393141F7B4E04009700D9 /* UIControl+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = B1A393131F7B4E04009700D9 /* UIControl+AutoTrack.m */; };
B1A9387C1F6A8AF600D6582C /* NSString+ER_URL.m in Sources */ = {isa = PBXBuildFile; fileRef = B1A9387B1F6A8AF600D6582C /* NSString+ER_URL.m */; };
B1B30D241F97A2140099EEED /* UIButton+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = B1B30D231F97A2140099EEED /* UIButton+AutoTrack.m */; };
B1B6C3A01F74AD3100627DF3 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = B1B6C3951F74AD3100627DF3 /* README.md */; };
B1B6C3A11F74AD3100627DF3 /* UIScrollView+YHExposure.m in Sources */ = {isa = PBXBuildFile; fileRef = B1B6C3991F74AD3100627DF3 /* UIScrollView+YHExposure.m */; };
B1B6C3A21F74AD3100627DF3 /* UITableView+YHExposure.m in Sources */ = {isa = PBXBuildFile; fileRef = B1B6C39B1F74AD3100627DF3 /* UITableView+YHExposure.m */; };
... ... @@ -116,14 +116,14 @@
29D3B9781F739D8300B07F47 /* YH_EventCollector+PowerfulBannerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "YH_EventCollector+PowerfulBannerView.m"; sourceTree = "<group>"; };
29D3B97A1F73A81E00B07F47 /* YH_EventCollector+UIActionSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "YH_EventCollector+UIActionSheet.h"; sourceTree = "<group>"; };
29D3B97B1F73A81E00B07F47 /* YH_EventCollector+UIActionSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "YH_EventCollector+UIActionSheet.m"; sourceTree = "<group>"; };
52540FA91F8F6BAD001907B3 /* YH_CrashReporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YH_CrashReporter.m; sourceTree = "<group>"; };
52540FAA1F8F6BAD001907B3 /* YH_CrashDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YH_CrashDataManager.h; sourceTree = "<group>"; };
52540FAB1F8F6BAD001907B3 /* YH_CrashReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YH_CrashReporter.h; sourceTree = "<group>"; };
52540FAC1F8F6BAD001907B3 /* YH_CrashDataManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YH_CrashDataManager.m; sourceTree = "<group>"; };
29FB39A81F7C9D67000E3B27 /* UIImageView+GestureAutoTrack.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIImageView+GestureAutoTrack.h"; sourceTree = "<group>"; };
29FB39A91F7C9D67000E3B27 /* UIImageView+GestureAutoTrack.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+GestureAutoTrack.m"; sourceTree = "<group>"; };
29FB39AB1F7C9D73000E3B27 /* UILabel+GestureAutoTrack.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UILabel+GestureAutoTrack.h"; sourceTree = "<group>"; };
29FB39AC1F7C9D73000E3B27 /* UILabel+GestureAutoTrack.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UILabel+GestureAutoTrack.m"; sourceTree = "<group>"; };
52540FA91F8F6BAD001907B3 /* YH_CrashReporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YH_CrashReporter.m; sourceTree = "<group>"; };
52540FAA1F8F6BAD001907B3 /* YH_CrashDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YH_CrashDataManager.h; sourceTree = "<group>"; };
52540FAB1F8F6BAD001907B3 /* YH_CrashReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YH_CrashReporter.h; sourceTree = "<group>"; };
52540FAC1F8F6BAD001907B3 /* YH_CrashDataManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YH_CrashDataManager.m; sourceTree = "<group>"; };
5255C2A51F5D25F400A8FC5F /* UICollectionView+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UICollectionView+AutoTrack.h"; sourceTree = "<group>"; };
5255C2A61F5D25F400A8FC5F /* UICollectionView+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UICollectionView+AutoTrack.m"; sourceTree = "<group>"; };
5255C2A71F5D25F400A8FC5F /* UITableView+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+AutoTrack.h"; sourceTree = "<group>"; };
... ... @@ -182,10 +182,10 @@
B14C0C971F8E2E9B00D963F3 /* UITapGestureRecognizer+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITapGestureRecognizer+AutoTrack.h"; sourceTree = "<group>"; };
B14C0C981F8E2E9B00D963F3 /* UITapGestureRecognizer+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITapGestureRecognizer+AutoTrack.m"; sourceTree = "<group>"; };
B17F61DA1F6678CD009D1606 /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
B1A393121F7B4E04009700D9 /* UIControl+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIControl+AutoTrack.h"; sourceTree = "<group>"; };
B1A393131F7B4E04009700D9 /* UIControl+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIControl+AutoTrack.m"; sourceTree = "<group>"; };
B1A9387A1F6A8AF600D6582C /* NSString+ER_URL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSString+ER_URL.h"; sourceTree = "<group>"; };
B1A9387B1F6A8AF600D6582C /* NSString+ER_URL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSString+ER_URL.m"; sourceTree = "<group>"; };
B1B30D221F97A2140099EEED /* UIButton+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+AutoTrack.h"; sourceTree = "<group>"; };
B1B30D231F97A2140099EEED /* UIButton+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+AutoTrack.m"; sourceTree = "<group>"; };
B1B6C3951F74AD3100627DF3 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
B1B6C3981F74AD3100627DF3 /* UIScrollView+YHExposure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+YHExposure.h"; sourceTree = "<group>"; };
B1B6C3991F74AD3100627DF3 /* UIScrollView+YHExposure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+YHExposure.m"; sourceTree = "<group>"; };
... ... @@ -315,6 +315,8 @@
5255C2A41F5D25F400A8FC5F /* YH_AOP */ = {
isa = PBXGroup;
children = (
B1B30D221F97A2140099EEED /* UIButton+AutoTrack.h */,
B1B30D231F97A2140099EEED /* UIButton+AutoTrack.m */,
2955040F1F67B78F006A3F14 /* UITableViewCell+AutoTrack.h */,
295504101F67B78F006A3F14 /* UITableViewCell+AutoTrack.m */,
5255C2A91F5D25F400A8FC5F /* YHSwizzle.h */,
... ... @@ -337,8 +339,6 @@
2955040D1F66B4A1006A3F14 /* UIApplication+AutoTrack.m */,
29CDB4AF1F6FA5A500AAD350 /* PowerfulBannerView+AutoTrack.h */,
29CDB4B01F6FA5A500AAD350 /* PowerfulBannerView+AutoTrack.m */,
B1A393121F7B4E04009700D9 /* UIControl+AutoTrack.h */,
B1A393131F7B4E04009700D9 /* UIControl+AutoTrack.m */,
B1475E651F7F37FC0066B514 /* NSURLConnection+AutoTrack.h */,
B1475E661F7F37FC0066B514 /* NSURLConnection+AutoTrack.m */,
B1475E6B1F7F38280066B514 /* NSURLSession+AutoTrack.h */,
... ... @@ -719,11 +719,11 @@
B1475E671F7F37FC0066B514 /* NSURLConnection+AutoTrack.m in Sources */,
29D3B9761F739D2F00B07F47 /* YH_EventCollector+UIAlertView.m in Sources */,
529A00511F564E8500A83F63 /* ViewController.m in Sources */,
B1B30D241F97A2140099EEED /* UIButton+AutoTrack.m in Sources */,
29CDB4B11F6FA5A500AAD350 /* PowerfulBannerView+AutoTrack.m in Sources */,
52878C041F5E8904000A1597 /* YHLog.m in Sources */,
B1475E6D1F7F38280066B514 /* NSURLSession+AutoTrack.m in Sources */,
B1F3F9791F7399380069C68C /* YH_Status.m in Sources */,
B1A393141F7B4E04009700D9 /* UIControl+AutoTrack.m in Sources */,
B1F3F9761F7399380069C68C /* YH_AnalyticEventData.m in Sources */,
52D204E81F60E6F900CB7F1A /* UITabBar+AutoTrack.m in Sources */,
B1B6C3A41F74AD3100627DF3 /* YHExposureManager.m in Sources */,
... ...
... ... @@ -19,7 +19,7 @@
#import "UIWebView+AutoTrack.h"
#import "UIViewController+AutoTrack.h"
#import "UITabBar+AutoTrack.h"
#import "UIControl+AutoTrack.h"
#import "UIButton+AutoTrack.h"
#import "UITapGestureRecognizer+AutoTrack.h"
#import "NSURLConnection+AutoTrack.h"
#import "YH_EventCacheManager.h"
... ... @@ -169,7 +169,7 @@ static NSArray *kYHEventReportIgnoredViewControllerArray;
}
if ([YHEventReport sharedInstance].isButtonPerformanceTrackEnable) {
[UIControl startTrack];
[UIButton startTrack];
[UITapGestureRecognizer startTrack];
[UITableView startTrack];
[UICollectionView startTrack];
... ...
//
// UIControl+AutoTrack.h
// UIButton+AutoTrack.h
// YHEventReport
//
// Created by 孙凯 on 2017/9/27.
... ... @@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
@interface UIControl (AutoTrack)
@interface UIButton (AutoTrack)
@property(nonatomic,copy)NSString *yh_viewId;//唯一ID
... ...
//
// UIControl+AutoTrack.m
// UIButton+AutoTrack.m
// YHEventReport
//
// Created by 孙凯 on 2017/9/27.
// Copyright © 2017年 YOHO. All rights reserved.
//
#import "UIControl+AutoTrack.h"
#import "UIButton+AutoTrack.h"
#import "YHSwizzle.h"
#import <objc/runtime.h>
#import <objc/message.h>
... ... @@ -14,7 +14,7 @@
#import "YHEventReport.h"
#import "YH_EventCollector.h"
@implementation UIControl (AutoTrack)
@implementation UIButton (AutoTrack)
+(void)startTrack{
static dispatch_once_t onceToken;
... ... @@ -45,6 +45,7 @@
#pragma mark - hook func
+ (void)yher_exchangeSelector:(SEL)originSel target:(nullable id)target toSelector:(SEL)replazSel
{
Class originalClass = object_getClass(target);
Class swizzledClass = [self class];
SEL originalSelector = originSel;
... ... @@ -91,7 +92,7 @@
}
#pragma mark - action
- (void)yher_UIControl_didTouch_cmdWithEvent:(UIControl*)sender
- (void)yher_UIControl_didTouch_cmdWithEvent:(UIButton*)sender
{
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].isButtonPerformanceTrackEnable) {
... ... @@ -105,7 +106,6 @@
}
}
- (void)yher_UIControl_didTouch_cmd
{
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].isButtonPerformanceTrackEnable) {
... ... @@ -137,16 +137,16 @@
{
NSString *selectorAction = NSStringFromSelector(action);
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].isButtonPerformanceTrackEnable && [self isKindOfClass:[UIButton class]]&&![selectorAction isEqualToString:@"backAction:"] && [target respondsToSelector:action] && (controlEvents == UIControlEventTouchUpInside)) {
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].isButtonPerformanceTrackEnable && ![selectorAction isEqualToString:@"backAction:"] && [target respondsToSelector:action] && (controlEvents == UIControlEventTouchUpInside) && ![target isKindOfClass:NSClassFromString(@"UISearchBarTextField")]) {
if ([[selectorAction componentsSeparatedByString:@":"]count]==1) {
[UIControl yher_exchangeSelector:action target:target toSelector:@selector(yher_UIControl_didTouch_cmd)];
[UIButton yher_exchangeSelector:action target:target toSelector:@selector(yher_UIControl_didTouch_cmd)];
}else if ([[selectorAction componentsSeparatedByString:@":"]count]==2){
[UIControl yher_exchangeSelector:action target:target toSelector:@selector(yher_UIControl_didTouch_cmdWithEvent:)];
[UIButton yher_exchangeSelector:action target:target toSelector:@selector(yher_UIControl_didTouch_cmdWithEvent:)];
}
if ([selectorAction isEqualToString:@"blockAction:forEvent:"]) {
[UIControl yher_exchangeSelector:action target:target toSelector:@selector(yher_blockAction:forEvent:)];
[UIButton yher_exchangeSelector:action target:target toSelector:@selector(yher_blockAction:forEvent:)];
}
}
... ...
... ... @@ -17,7 +17,7 @@
#import "UIViewController+AutoTrack.h"
#import "UIWebView+AutoTrack.h"
#import "UITabBarItem+Yoho.h"
#import "UIControl+AutoTrack.h"
#import "UIButton+AutoTrack.h"
#import "UITapGestureRecognizer+AutoTrack.h"
#import "NSURLSession+AutoTrack.h"
#import "NSURLConnection+AutoTrack.h"
... ... @@ -313,8 +313,8 @@
}
}
#pragma mark - UIControl performance
- (void)timeEventStartWithUIControl:(UIControl *)control
#pragma mark - UIButton performance
- (void)timeEventStartWithUIControl:(UIButton *)control
{
if (!control) {
return;
... ... @@ -335,7 +335,7 @@
});
}
- (void)timeEventEndWithUIControl:(UIControl *)control
- (void)timeEventEndWithUIControl:(UIButton *)control
{
if (!control) {
return;
... ...