AppMetricaCrashReporting protocol
The AppMetricaCrashReporting
protocol contains methods for customizing error and crash messages.
Instance methods
Sends an |
|
Sends an |
|
Sends a message about an error matching the |
|
Sends a message about an error matching the |
|
Sets the key-value pair that will be associated with errors and crashes. |
|
Creates an |
Method descriptions
reportNSError(_:onFailure:)
class func reportNSError(_ error: (any Error)?, onFailure: ((_ error: (any Error)?) -> Void)? = nil)
Sends an NSError
message that is subject to certain restrictions on domain
, userInfo
, and other properties.
You can enable NSError
backtracing by using the BacktraceErrorKey
constant in the userInfo
property.
Restrictions:
domain
: No more than 200 characters.userInfo
: No more than 50 key-value pairs with keys no longer than 100 characters and values no longer than 2000 characters.NSUnderlyingErrorKey
: Using this key inuserInfo
enables you to include up to 10 errors.BacktraceErrorKey
: Using this key inuserInfo
allows you to include up to 200 stack frames in the backtrace.
AppMetrica truncates the value if it exceeds the specified limit.
Parameters:
|
The |
|
Callback method to call if an error occurs while sending the message. The |
reportNSError(_:options:onFailure:)
class func reportNSError(_ error: (any Error)?, options: ErrorReportingOptions, onFailure: ((_ error: (any Error)?) -> Void)? = nil)
Sends a custom NSError
message that adheres to the restrictions on domain
, userInfo
, and other properties.
You can enable NSError
backtracing by using the BacktraceErrorKey
constant in the userInfo
property.
Restrictions:
domain
: No more than 200 characters.userInfo
: No more than 50 key-value pairs with keys no longer than 100 characters and values no longer than 2000 characters.NSUnderlyingErrorKey
: Using this key inuserInfo
enables you to include up to 10 errors.BacktraceErrorKey
: Using this key inuserInfo
allows you to include up to 200 stack frames in the backtrace.
AppMetrica truncates the value if it exceeds any of these limits.
Parameters:
|
The |
|
Additional ErrorReportingOptions options that define how the error message is sent. |
|
Callback method to call if an error occurs while sending the message. The |
reportError(_:onFailure:)
class func reportError(_ error: (any ErrorRepresentable)?, onFailure: ((_ error: (any Error)?) -> Void)? = nil)
Sends a message about an error matching the ErrorRepresentable protocol.
Parameters:
|
Error that matches the |
|
Callback method to call if an error occurs while sending the message. The |
reportError(_:options:onFailure:)
class func reportError(_ error: (any ErrorRepresentable)?, options: ErrorReportingOptions, onFailure: ((_ error: (any Error)?) -> Void)? = nil)
Sends a message about an error matching the ErrorRepresentable protocol, with additional options for message customization.
Parameters:
|
Error that matches the |
|
Additional ErrorReportingOptions options that define how the error message is sent. |
|
Callback method to call if an error occurs while sending the message. The |
setErrorEnvironmentValue(_:forKey:)
class func setErrorEnvironmentValue(_ value: String?, forKey key: String?)
Sets the key-value pair that will be associated with errors and crashes. AppMetrica uses it as additional information for unhandled exceptions.
Parameters:
|
Value to associate with the key. Passing |
|
Key associated with the value. |
pluginExtension()
class func pluginExtension() -> (any AppMetricaPlugins)?
Creates an AppMetricaPlugins
instance that can send plugin events to the main API key. You can request it every time or store a reference for future use. To use this extension, first activate AppMetrica with the [AppMetrica activateWithConfiguration:]
method.
Returns:
A plugin extension instance.