Set the Username with the Aternity iOS Mobile SDK (userNameStr)

You can set a username for a mobile app in Aternity Mobile SDK to be consistent with desktops and laptops, so you can track this user's experience across all devices and platforms. The Aternity class provides a property called userNameStr, which you can set at initialization or manually at any time.

Example of usernames for mobile devices displayed in the dashboards

By default, an empty username is displayed as Other or Unknown in the dashboards.

The Aternity class provides the sharedManager method, which returns a singleton object. You should call the class's methods using this singleton object, to avoid manually creating and maintaining the Aternity object.

Before You Begin

Before you begin, ensure you have already done the following:

Property Definition

The userNameStr is defined as a property in the Aternity class:

@property(copy) NSString *userNameStr;
Property Description

userNameStr

Set this to be the username you want to appear in the dashboards, defined as a string.

If you set the username before performing initialization, it passes the username upon initialization.

Example

In Objective-C

[Aternity sharedManager].userNameStr = @"Irene_Wilkins"; 

In Swift:

Aternity.sharedManager().userNameStr = "Irene_Wilkins"