MParticleUser Class Reference

Inherits from NSObject
Declared in MParticleUser.h

Overview

A single user as represented by the mParticle SDK

  userId

The mParticle id associated with this user (MPID)

@property (readonly, strong, nonnull) NSNumber *userId

Discussion

The mParticle id associated with this user (MPID)

Declared In

MParticleUser.h

  firstSeen

The date when this user was first seen by the SDK

@property (readonly, strong, nonnull) NSDate *firstSeen

Discussion

The date when this user was first seen by the SDK

Declared In

MParticleUser.h

  lastSeen

The date when this user was most recently seen by the SDK

@property (readonly, strong, nonnull) NSDate *lastSeen

Discussion

The date when this user was most recently seen by the SDK

Declared In

MParticleUser.h

  isLoggedIn

Returns whether this user is currently logged in

@property (readonly) BOOL isLoggedIn

Discussion

Returns whether this user is currently logged in

Declared In

MParticleUser.h

  identities

Gets current identities (readonly)

@property (readonly, strong, nonnull) NSDictionary<NSNumber*NSString*> *identities

Return Value

A dictionary containing the collection of all identities including device identities

Discussion

Gets current identities (readonly)

See Also

Declared In

MParticleUser.h

  userAttributes

Gets/sets all user attributes.

@property (readwrite, strong, nonnull) NSDictionary<NSString*id> *userAttributes

Return Value

A dictionary containing the collection of user attributes.

Discussion

Gets/sets all user attributes.

Declared In

MParticleUser.h

– incrementUserAttribute:byValue:

Increments the value of a user attribute by the provided amount. If the key does not exist among the current user attributes, this method will add the key to the user attributes and set the value to the provided amount. If the key already exists and the existing value is not a number, the operation will abort.

- (nullable NSNumber *)incrementUserAttribute:(NSString *)key byValue:(NSNumber *)value

Parameters

key

The attribute key

value

The increment amount

Return Value

The static value @0

Discussion

Increments the value of a user attribute by the provided amount. If the key does not exist among the current user attributes, this method will add the key to the user attributes and set the value to the provided amount. If the key already exists and the existing value is not a number, the operation will abort.

Note: this method has been changed to be async, return value will always be @0.

Declared In

MParticleUser.h

– setUserAttribute:value:

Sets a single user attribute. The property will be combined with any existing attributes. There is a 100 count limit to user attributes.

- (void)setUserAttribute:(NSString *)key value:(id)value

Parameters

key

The user attribute key

value

The user attribute value

Discussion

Sets a single user attribute. The property will be combined with any existing attributes. There is a 100 count limit to user attributes.

Declared In

MParticleUser.h

– setUserAttributeList:values:

Sets a list of user attributes associated with a key.

- (void)setUserAttributeList:(NSString *)key values:(NSArray<NSString*> *)values

Parameters

key

The user attribute list key

values

An array of user attributes

Discussion

Sets a list of user attributes associated with a key.

Declared In

MParticleUser.h

– setUserTag:

Sets a single user tag or attribute. The property will be combined with any existing attributes. There is a 100 count limit to user attributes.

- (void)setUserTag:(NSString *)tag

Parameters

tag

The user tag/attribute

Discussion

Sets a single user tag or attribute. The property will be combined with any existing attributes. There is a 100 count limit to user attributes.

Declared In

MParticleUser.h

– removeUserAttribute:

Removes a single user attribute.

- (void)removeUserAttribute:(NSString *)key

Parameters

key

The user attribute key

Discussion

Removes a single user attribute.

Declared In

MParticleUser.h

– setConsentState:

Sets the user’s current consent state.

- (void)setConsentState:(MPConsentState *)state

Parameters

state

A consent state object

Discussion

Sets the user’s current consent state.

Declared In

MParticleUser.h

– consentState

Gets the users consent state.

- (nullable MPConsentState *)consentState

Return Value

The user’s current consent state object

Discussion

Gets the users consent state.

Declared In

MParticleUser.h