整合 Bugly 相关功能,新增 BuglyManager 类以统一管理 Bugly 配置和错误上报,优化 AppDelegate 中的 Bugly 配置逻辑。同时,更新多个模块以使用 BuglyManager 进行错误上报,提升代码可维护性和一致性。新增 BuglyManager 使用说明文档,提供详细的使用示例和功能介绍。

This commit is contained in:
edwinQQQ
2025-08-28 14:40:05 +08:00
parent dce3ea94ce
commit d22ddaefcf
11 changed files with 676 additions and 99 deletions

View File

@@ -11,6 +11,7 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <Bugly/Bugly.h>
#import "BuglyManager.h"
#import "Api+Gift.h"
@@ -790,19 +791,17 @@ NSString * const kBoomStateForceResetNotification = @"BoomStateForceResetNotific
self.errorMessage = [NSString stringWithFormat:@"服务器繁忙,请稍后重试 - %@", msg];
#else
self.errorMessage = @"Over Heat & try later";
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSMutableDictionary *logDic = [@{@"targetUids": allUIDs,
@"giftNum": self.giftNumPerTimes} mutableCopy];
[logDic addEntriesFromDictionary:dic];
[logDic setObject:[NSThread callStackSymbols] forKey:@"call stack symbols"];
[logDic setObject:msg forKey:@"error message"];
[logDic setObject:@"gift/sendV5" forKey:@"http method"];
[Bugly reportError:[NSError errorWithDomain:[NSString stringWithFormat:@"UID: %@,API: %@ 异常",
[AccountInfoStorage instance].getUid,
@"gift/sendV5"]
code:code
userInfo:logDic]];
});
// 使 BuglyManager
NSString *uid = [AccountInfoStorage instance].getUid ?: @"未知用户";
NSMutableDictionary *userInfo = [@{@"targetUids": allUIDs,
@"giftNum": self.giftNumPerTimes} mutableCopy];
[userInfo addEntriesFromDictionary:dic];
[userInfo setObject:msg forKey:@"error message"];
[[BuglyManager sharedManager] reportNetworkError:uid
api:@"gift/sendV5"
code:code
userInfo:userInfo];
#endif
//
} else if (code == 31005) {

View File

@@ -20,6 +20,7 @@
///P
#import "XPGiftProtocol.h"
#import <Bugly/Bugly.h>
#import "BuglyManager.h"
@interface XPGiftPresenter ()
///