#import <TDOS_Diagnose/TDOS_Diagnose.h> // Log SDK module#import <TDOS_Diagnose/TDMMKVFactoryImpl.h> // MMKV module#import <TDOS_Diagnose/TDOSLoggerProxy.h> // Log printing module#import <TDOS_Diagnose/TDLogFilePackerImp.h> // File compression module// Uses the SDK's default modules.TDOSLoggerProxy *loggerProxy = [TDOSLoggerProxy defaultProxy];TDMMKVFactory *kvFactory = [TDMMKVFactoryImpl sharedInstance];TDLogFilePackerImp *filePacker = [[TDLogFilePackerImp alloc] init];// Creates a TDIAGDepends instance.TDIAGDepends *depends = [TDIAGDepends dependsWithLogImp:loggerProxykvFactoryImp:kvFactoryandFilePackerImp:filePacker];
// appid & appKey, generated by the platformNSString *appID = BUGLY_APPID;NSString *appKey = BUGLY_APPKEY;
- (NSString *)guidForTDLog; method must be implemented. This method returns a unique user ID, which is used when the platform issues commands.// Creates a log retrieval module configuration instance and initializes it.TDLogSDKConfig *config = [TDLogSDKConfig configWithAppId:appIDappKey:appKeydataSource:selfdepends:depends];
/// Sets the service domain type.@property (nonatomic,assign)TDLogServerHostType serverHostType;/// Sets the reporting domain.https://cloud.bugly.qq.com/// Customizes the server domain.@property(nonatomic,strong)NSString *customServerHost;
// Enables frequency control (default unlimited). Pass empty to use the SDK's default policy: 2 times/5min, or pass a custom policy. When restricted, the automatic reporting API callback will indicate failure.// Example: Allow at most 3 reports within 10 minutes (using token bucket algorithm).// TDLogFrequencyControlStrategy *strategy = [TDLogFrequencyControlStrategy new];// strategy.times = 3;// strategy.timeInterval = 10 * 60;// Note: This API requires TDLogSDKDataSource to implement the whitelistForAutoUploadTags protocol, which provides an allowlist of tags for automatic reporting. This ensures that essential reports are not blocked.[config setFrequencyLimitStatusForAutoUpload:YESwithCustomControlStrategy:nil]; // Recommended setting to prevent frequent automatic reporting// Enables traffic control (default: unlimited). Pass 0 to disable reporting. Pass a negative value for no limit. When limited, the automatic reporting API callback will indicate failure.// Note: This API requires TDLogSDKDataSource to implement the whitelistForAutoUploadTags protocol, which provides an allowlist of tags for automatic reporting. This ensures that essential reports are not blocked.[config setTrafficQuota24hLimitForAutoUpload:(200 * 1024 * 1024)xgQuota:(50 * 1024 * 1024)]; // Optional. Sets the traffic limit for automatic reporting.
[[TDLogSDK sharedInstance] startWithConfig:config];
// Initializes the log printing module.TDOSLoggerConfig *loggerConfig = [TDOSLoggerConfig defaultConfig];TDOSLogger *logger = [[TDOSLogger alloc] initWithConfig:loggerConfig];
TDOSLoggerProxy *loggerProxy = [TDOSLoggerProxy defaultProxy];[loggerProxy setLogger:logger];
post_install do |installer|installer.pods_project.targets.each do |target|if target.name == "MMKV"target.build_configurations.each do |config|config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'MMKV_IOS_EXTENSION']endendendend
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback