// // BugTool.m // Unity-iPhone // // Created by duowan123 on 2022/4/6. // #import "BugTool.h" #import "AvoidCrash.h" //#import @implementation BugTool +(void)startAvoidBug{ // //bugly抓取 // NSString * bundleIdentifier = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; // if ([bundleIdentifier isEqualToString:@"com.Oujia.Run"]){ // [Bugly startWithAppId:@"36a0c05291"]; // }else if ([bundleIdentifier isEqualToString:@"com.Oujia.Dance"]){ // [Bugly startWithAppId:@"403d275730"]; // }else if ([bundleIdentifier isEqualToString:@"com.Oujia.Tricycle"]){ // [Bugly startWithAppId:@"60d408c425"]; // } // //AvoidCrash防奔溃 + bug闪退信息上报 [AvoidCrash makeAllEffective]; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dealwithCrashMessage:) name:AvoidCrashNotification object:nil]; // //} // //- (void)dealwithCrashMessage:(NSNotification *)note{ // // NSDictionary *info = note.userInfo; // NSString *errorReason = [NSString stringWithFormat:@"【ErrorReason】%@========【ErrorPlace】%@========【DefaultToDo】%@========【ErrorName】%@", info[@"errorReason"], info[@"errorPlace"], info[@"defaultToDo"], info[@"errorName"]]; // NSLog(@"errorReason = %@",errorReason); // NSArray *callStack = info[@"callStackSymbols"]; // [self reportErrorName:@"Bugly_ErrorName_AvoidCrash" errorReason:errorReason callStack:callStack extraInfo:nil]; // //} // ///** 上报错误信息 */ //- (void)reportErrorName:(NSString *)errorName errorReason:(NSString *)errorReason callStack:(NSArray *)aStackArray extraInfo:(NSDictionary *)info{ // [Bugly reportExceptionWithCategory:3 name:errorName reason:errorReason callStack:aStackArray extraInfo:info terminateApp:NO]; } @end