BugTool.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // BugTool.m
  3. // Unity-iPhone
  4. //
  5. // Created by duowan123 on 2022/4/6.
  6. //
  7. #import "BugTool.h"
  8. #import "AvoidCrash.h"
  9. //#import <Bugly/Bugly.h>
  10. @implementation BugTool
  11. +(void)startAvoidBug{
  12. // //bugly抓取
  13. // NSString * bundleIdentifier = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
  14. // if ([bundleIdentifier isEqualToString:@"com.Oujia.Run"]){
  15. // [Bugly startWithAppId:@"36a0c05291"];
  16. // }else if ([bundleIdentifier isEqualToString:@"com.Oujia.Dance"]){
  17. // [Bugly startWithAppId:@"403d275730"];
  18. // }else if ([bundleIdentifier isEqualToString:@"com.Oujia.Tricycle"]){
  19. // [Bugly startWithAppId:@"60d408c425"];
  20. // }
  21. // //AvoidCrash防奔溃 + bug闪退信息上报
  22. [AvoidCrash makeAllEffective];
  23. // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dealwithCrashMessage:) name:AvoidCrashNotification object:nil];
  24. //
  25. //}
  26. //
  27. //- (void)dealwithCrashMessage:(NSNotification *)note{
  28. //
  29. // NSDictionary *info = note.userInfo;
  30. // NSString *errorReason = [NSString stringWithFormat:@"【ErrorReason】%@========【ErrorPlace】%@========【DefaultToDo】%@========【ErrorName】%@", info[@"errorReason"], info[@"errorPlace"], info[@"defaultToDo"], info[@"errorName"]];
  31. // NSLog(@"errorReason = %@",errorReason);
  32. // NSArray *callStack = info[@"callStackSymbols"];
  33. // [self reportErrorName:@"Bugly_ErrorName_AvoidCrash" errorReason:errorReason callStack:callStack extraInfo:nil];
  34. //
  35. //}
  36. //
  37. ///** 上报错误信息 */
  38. //- (void)reportErrorName:(NSString *)errorName errorReason:(NSString *)errorReason callStack:(NSArray *)aStackArray extraInfo:(NSDictionary *)info{
  39. // [Bugly reportExceptionWithCategory:3 name:errorName reason:errorReason callStack:aStackArray extraInfo:info terminateApp:NO];
  40. }
  41. @end