
- Removed YuMi/Library/ (138 MB, not tracked) - Removed YuMi/Resources/ (23 MB, not tracked) - Removed old version assets (566 files, not tracked) - Excluded Pods/, xcuserdata/ and other build artifacts - Clean repository optimized for company server deployment
80 lines
2.3 KiB
Objective-C
80 lines
2.3 KiB
Objective-C
//
|
||
// BuglyManagerExample.m
|
||
// YuMi
|
||
//
|
||
// Created by BuglyManager Example
|
||
// Copyright © 2024 YuMi. All rights reserved.
|
||
//
|
||
|
||
#import "BuglyManagerExample.h"
|
||
#import "BuglyManager.h"
|
||
|
||
@implementation BuglyManagerExample
|
||
|
||
#pragma mark - 使用示例
|
||
|
||
// 示例1:设置代理监听卡顿
|
||
- (void)setupBuglyDelegate {
|
||
[BuglyManager sharedManager].delegate = self;
|
||
}
|
||
|
||
// 示例2:上报业务错误
|
||
- (void)reportBusinessErrorExample {
|
||
NSDictionary *context = @{
|
||
@"page": @"HomePage",
|
||
@"action": @"loadData",
|
||
@"timestamp": @([[NSDate date] timeIntervalSince1970])
|
||
};
|
||
|
||
[[BuglyManager sharedManager] reportBusinessError:@"数据加载失败"
|
||
code:1001
|
||
context:context];
|
||
}
|
||
|
||
// 示例3:上报网络错误
|
||
- (void)reportNetworkErrorExample {
|
||
NSDictionary *userInfo = @{
|
||
@"requestParams": @{@"userId": @"12345"},
|
||
@"responseData": @"服务器错误"
|
||
};
|
||
|
||
[[BuglyManager sharedManager] reportNetworkError:@"user123"
|
||
api:@"user/profile"
|
||
code:500
|
||
userInfo:userInfo];
|
||
}
|
||
|
||
// 示例4:上报内购错误
|
||
- (void)reportIAPErrorExample {
|
||
NSDictionary *context = @{
|
||
@"retryCount": @3,
|
||
@"productId": @"com.yumi.coin100"
|
||
};
|
||
|
||
[[BuglyManager sharedManager] reportIAPError:@"user123"
|
||
transactionId:@"txn_123456"
|
||
orderId:@"order_789"
|
||
status:2
|
||
context:context];
|
||
}
|
||
|
||
#pragma mark - BuglyManagerDelegate
|
||
|
||
- (void)buglyManager:(BuglyManager *)manager didDetectLag:(NSTimeInterval)duration {
|
||
NSLog(@"[Example] 检测到卡顿,持续时间: %.2f 秒", duration);
|
||
|
||
// TODO: 在这里实现卡顿通知逻辑
|
||
// 1. 记录到本地日志
|
||
// 2. 发送本地通知
|
||
// 3. 上报到性能监控系统
|
||
// 4. 触发用户反馈机制
|
||
}
|
||
|
||
- (void)buglyManager:(BuglyManager *)manager didDetectBlock:(NSTimeInterval)duration {
|
||
NSLog(@"[Example] 检测到主线程阻塞,持续时间: %.2f 秒", duration);
|
||
|
||
// TODO: 在这里实现阻塞通知逻辑
|
||
}
|
||
|
||
@end
|