startInteraction (iOS SDK API)

Syntax

+ (NSString*) startInteractionWithName:(NSString*)interactionName;

Starts an interaction trace.

Requirements

Compatible with all agent versions.

Description

This method will start an interaction trace using interactionName as the name. The interaction will record all instrumented methods until a timeout occurs or stopCurrentInteraction is called.

For context on how to use this API, see the documentation about interaction traces:

Parameters

Parameter

Description

$interactionName

string

Required. The name of the interaction trace.

Return values

If startInteractionWithName is called, the return value is an interactionIdentifier that must be passed to stopCurrentInteraction . But it's not required to call stopCurrentInteraction after calling start because startInteractionWithName will eventually complete intelligently.

Examples

Objective-C

Example:

NSString *identifier = [NewRelic startInteractionWithName: @"myInteractionName"];
[NewRelic stopCurrentInteraction: identifier];

Swift

Example:

let identifier = NewRelic.startInteraction(withName: "myInteractionName")
NewRelic.stopCurrentInteraction(identifier)