• /
  • Log in
  • Free account

recordBreadcrumb (iOS SDK API)

Syntax

recordBreadcrumb:(NSString* __nonnull)name attributes:(NSDictionary* __nullable)attributes;
NewRelic.recordBreadcrumb(string $Name, map $eventAttributes)

Records a MobileBreadcrumb event, useful for crash analysis.

Requirements

Agent version 5.13.0 or higher.

Description

This call creates and records a MobileBreadcrumb event, which can be found in Insights and in the crash event trail. Mobile breadcrumbs are useful for crash analysis; create them for app activity that you think will help you troubleshoot crashes.

In addition to whatever custom attributes you choose, the event will also have associated session attributes. Unlike using setAttribute, adding attributes to a breadcrumb event adds them only to that event; they are not session attributes.

Using this call has the same result as using the recordCustomEvent call with MobileBreadcrumb as the event type. For context on how to use this API, see the documentation about sending custom attributes and events to Insights for:

Parameters

Parameter

Description

$Name

string

Required. The name you want to give to the breadcrumb event.

$eventAttributes

map<string, object>

Optional. A map that includes a list of attributes of the breadcrumb event. Create attributes for any event descriptors you think will be useful.

Return values

Returns true if the event is recorded successfully, or false if not.

Examples

Objective-C

Method:

+ (BOOL) recordBreadcrumb:(NSString* __nonnull)name attributes:(NSDictionary* __nullable)attributes;

Example:

[NewRelic recordBreadcrumb:@"user 11-3435 tapped sign-in button on LaunchViewController"
attributes:@{ @"button" : @"sign-in", @"action" : @"tapped", @"userId" : @"11-3435", @"location" : @"LaunchViewController"}];

Swift

Method:

NewRelic.recordBreadcrumb(Name: String!, attributes:[NSObject : AnyObject]!) -> Bool

Examples:

let eventRecorded = NewRelic.recordBreadcrumb("Name",
attributes: ["attributeName1" : "value1", "attributeName2": 2])
let eventRecorded = NewRelic.recordBreadcrumb("user 11-3435 tapped sign-in from LaunchViewController"
attributes:["button" : "sign-in", "userId" : "11-3435", "action" : "tapped", "location" : "LaunchViewController"])
Create issueEdit page
Copyright © 2022 New Relic Inc.