/// Sets a custom version number.@property (nonatomic, copy) NSString *appVersion;/// Sets a custom device unique identifier.@property (nonatomic, copy) NSString *deviceIdentifier;/// Sets a custom user ID.@property (nonatomic, copy) NSString *userIdentifier;/// Sets build config to fetch different configurations.@property (nonatomic, assign) BuglyBuildConfig buildConfig;/// Bugly Delegate@property (nonatomic, assign) id<BuglyDelegate> delegate;
/// Allows you to attach data to case reports./// param eventType Case event type/// @param customData Business custom fields/// @param eventInfo Case information (currently empty)- (NSDictionary<NSString *, NSString *> *)attachmentForEvent:(NSString *)eventTypecustomData:(BuglyCustomData *)customDataeventInfo:(NSDictionary *)eventInfo;#### 2. Callback for setting crash informationBugly trigger a callback to your business logic when reporting a crash. You can add custom logic in the callback.``` objective-c/*** Callback when an exception occurs* @param exception Exception information* @return The record to be reported along with the exception*/- (NSString * __nullable)attachmentForException:(NSException * __nullable)exception;
/// Custom log functionstatic void logger_func(RMLoggerLevel level, const char *log) {//handle sdk log.}
// Registers Bugly log output.[Bugly registerLogCallback:logger_func];
/*** Updates device ID.* @param deviceId Device ID*/+ (void)updateDeviceIdentifier:(NSString *)deviceId;
/*** Updates userId.* @param userId User ID*/+ (void)updateUserIdentifier:(NSString *)userId;
/*** Gets SDK version information.* @return SDK version number*/+ (NSString *)sdkVersion;
/*** @brief Reports a custom error.** @param category Type (Cocoa=3, CSharp=4, JS=5, Lua=6)* @param aName Name* @param aReason Error reason* @param aStackArray Stack trace* @param info Additional data* @param terminate Whether to terminate the app process after reporting*/+ (void)reportExceptionWithCategory:(NSUInteger)categoryname:(NSString *)aNamereason:(NSString *)aReasoncallStack:(NSArray *)aStackArrayextraInfo:(NSDictionary *)infoterminateApp:(BOOL)terminate;
/*** Reports an error.** @param error Error information*/+ (void)reportError:(NSError *)error;
/*** Reports a custom Objective-C exception.** @param exception Exception information*/+ (void)reportException:(NSException *)exception;
/*** Updates case tags. This must be called after Bugly SDK initialization (in the Bugly setup completeHandler callback); otherwise, data loss may occur.* SDK version: 2.7.53.3+* @params tagArr String array (max length: 30, each string max length: 1024 bytes)*/+ (void)updateCaseTags:(NSArray<NSString *> *)tagArr;
/*** Update business drill-down. This must be called after Bugly SDK initialization (the Bugly setup completeHandler callback); otherwise, data loss may occur.* SDK version: 2.7.53.3+* @params tagArr String array (max length: 30, each string max length: 1024 bytes)*/+ (void)updateTestTags:(NSArray<NSString *> *)tagArr;
/*** Sets key data to be reported along with crash information.** @param value KEY* @param key VALUE*/+ (void)setUserValue:(NSString *)value forKey:(NSString *)key;
/*** Gets custom data.** @return Key data*/+ (NSDictionary * _Nullable)allUserValues;
/*** Sets a collection of absolute paths for custom attachments.* The compressed file must not exceed 10 MB and will be uploaded on the next startup.*/+ (void)setAdditionalAttachmentPaths:(NSArray<NSString *>*)pathArray;
/// Updates scenario information./// @param key Scenario ID. Features such as lag, memory, and resource monitoring will cluster data based on this value.+ (void)setScene:(NSString *)key;
/// Ends the custom scenario and resumes using the scenario information automatically captured by RMonitor.+ (void)resetScene;
BuglyCustomData.h for details), with 10 keys per set. You can select appropriate keys to report data as needed. In the console, you can assign aliases to these keys for easier viewing and analysis. For custom dimensions, the server stores each field separately, enabling advanced query and analysis capabilities in the future. Currently, both global settings and pre-reporting callbacks are supported./*** Adds custom tags. Calling this before SDK initialization has no effect.* @param data Custom fields to be updated*/+ (void)updateCustomData:(BuglyCustomData *)data;/*** Gets a copy of the current custom tags. Returns empty if not set.* @return Configured custom fields*/+ (nullable BuglyCustomData *)currentCustomData;/*** Adds custom data for specific event reporting.* @param data Custom fields to be updated* @param eventType The corresponding event type*/+ (void)updateCustomData:(BuglyCustomData *)data forEvent:(BuglyEventTypeName)eventType;/*** Gets custom data for a specific event.* @param eventType The event type to get* @return The corresponding configured custom fields*/+ (nullable BuglyCustomData *)currentCustomDataForEvent:(BuglyEventTypeName)eventType;/*** Updates this custom data with new custom fields.* @param dict Dictionary information conforming to the BuglyCustomData storage format* @return The updated data*/- (BuglyCustomData *)customDataByUpdateDict:(NSDictionary *)dict;/***Gets numeric custom data.* @param key If the key is not defined in NumberParamKey, returns 0.0 immediately.* @return The current value if set; otherwise, 0.0.*/- (nullable NSNumber *)getNumberParam:(BuglyCustomNumberDataKey)key;/*** Sets numeric custom data.* @param key If the key is not defined in NumberParamKey, adding fails.* @param param NUMBER VALUE*/- (BOOL)putNumberParam:(nullable NSNumber *)param forKey:(BuglyCustomNumberDataKey)key;/*** Gets string custom data.* @param key If the key is not defined in StringParamKey, returns "" immediately.* @return The current value if set; otherwise, "".*/- (nullable NSString *)getStringParam:(BuglyCustomStringDataKey)key;/*** Sets string custom data.* @param key If the key is not defined in StringParamKey, adding fails.* @param param The length must not exceed BUGLY_CUSTOM_DATA_MAX_STRING_VALUE_LENGTH.* If value = null, it will be set to an empty string.* If value exceeds the length limit, it will be truncated to the first BUGLY_CUSTOM_DATA_MAX_STRING_VALUE_LENGTH characters.*/- (BOOL)putStringParam:(nullable NSString *)param forKey:(BuglyCustomStringDataKey)key;/*** Gets string array custom data.* @param key If the key is not defined in StringArrayParamKey, returns an empty list immediately.* @return The current value if set; otherwise, an empty list. The returned list cannot be modified.*/- (nullable NSArray<NSString *> *)getStringArrayParam:(BuglyCustomArrayDataKey)key;/*** The addition sequence is: A1 -> A2 -> A2 -> A3 -> A4. This API produces a result similar to: [A1, A2, A3, A4].* Adds VALUE to string array custom data.* @param key If the key is not defined in StringArrayParamKey, adding fails.* @param param A non-null, non-empty string. If the value does not exist, it will be added; if it exists, returns immediately. The length must not exceed BUGLY_CUSTOM_DATA_MAX_STRING_VALUE_LENGTH.*/- (BOOL)addStringToStringArrayParam:(NSString *)param forKey:(BuglyCustomArrayDataKey)key;/*** Removes VALUE from string array custom data.* @param key If the key is not defined in StringArrayParamKey, removal fails.* @param param If the value exists, it will be removed; if it does not exist, returns immediately.*/- (BOOL)removeStringFromStringArrayParam:(NSString *)param forKey:(BuglyCustomArrayDataKey)key;/*** The addition sequence is: A1 -> A2 -> A2 -> A3 -> A4. This API produces a result similar to: [A1, A2, A2, A3, A4].* Adds VALUE to string array custom data.* @param key If the key is not defined in StringArrayParamKey, adding fails.* @param param The length must not exceed BUGLY_CUSTOM_DATA_MAX_STRING_VALUE_LENGTH. The value is added regardless of whether it exists, allowing duplicates.* @return Returns failure if the value is null, empty, exceeds the length limit, or the array has reached its maximum size; otherwise, returns success.*/- (BOOL)addStringToSequence:(NSString *)param forKey:(BuglyCustomArrayDataKey)key;
main function execution time" highly unpredictable. Therefore, this uncertain interval is excluded from the cold start duration calculation, which is adjusted as follows: Cold start duration = First frame rendering time – main function execution time + App process initialization end time – App process creation time+ (void)startSpan:(NSString *)spanName parentSpanName:(nullable NSString *)parentSpanName of BuglyLaunchMonitorPlugin to record the start timestamp of a custom scenario.[BuglyLaunchMonitorPlugin startSpan:@"testSpan" parentSpanName:nil];
+ (void)endSpan:(NSString *)spanName of BuglyLaunchMonitorPlugin to mark the end of a custom scenario interval. Ensure the spanName matches the one used when starting the span; otherwise, the data will be considered invalid.[BuglyLaunchMonitorPlugin endSpan:@"testSpan"];
+ (void)endSpanFromLaunch:(NSString *)spanName of BuglyLaunchMonitorPlugin to record the duration of a span measured from process creation.[BuglyLaunchMonitorPlugin endSpanFromLaunch:@"testSpan"];
- (void)addTag:(NSString *)tagName of BuglyLaunchMonitorPlugin to add a tag.- (void)removeTag:(NSString *)tagName of BuglyLaunchMonitorPlugin to remove a tag.[BuglyLaunchMonitorPlugin addTag:@"tagTest1"];[BuglyLaunchMonitorPlugin removeTag:@"tagTest1"];
CA::Transaction::commit. Therefore, the - (void)endColdLaunch API is added for you to actively call and declare that the cold start has ended. Calling this API will trigger startup data reporting, and subsequent updates to tags or span information will not take effect.[BuglyLaunchMonitorPlugin endColdLaunch];
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