Overview

Skill Level: Any

Performing an attributes operation is done by using the attributes client that can be created from the MCEAttributesQueueManager class.

Prerequisites

Not what you’re looking for? Check out all our available tutorials for mobile app messaging here.

 

Step-by-step

  1. Set or update an attributes operation

    To set or update, pass an NSDictionary of attributes names and their values, which can have different types. To delete, just pass an NSArray of NSStrings which correspond to the names of the attributes you want to delete for that user.

    Note: Attribute updates can be non-intuitive. They are cached both on the device and the server, which can lead to issues if you update attributes from the SDK and via API.

    In addition, lookup key attributes may not be updated by SDK. See Understanding user attributes for further details and limitations of using attributes from the SDK.

    Example:

    @property MCEAttributesQueueManager * queue;
    
    - (instancetype) init {
    if (self = [super init]) {
    // ...
    self.queue = [
    [MCEAttributesQueueManager alloc] init
    ];
    // ...
    }
    return (self);
    }
    
    // To set or update one or more attributes
    NSDictionary * attributes = @ {@
    "hobby": @ "movies",
    @"age": @40,
    @"getsCatalogue": YES,
    @"lastUpdate": [NSDate date]
    };
    [self.queue updateUserAttributes: attributes]
    
    // To delete one or more attributes
    NSString * attributeKeys = @ [@"hobby", @"getsCatalogue"];
    [self.queue deleteUserAttributes: attributeKeys]
    

    You can add observers for UpdateUserAttributesSuccess, UpdateUserAttributesError, DeleteUserAttributesSucces, and DeleteUserAttributesError to determine if the attributes were sent successfully.

Expected outcome

Need more help? Check out all of our available tutorials for mobile app messaging here.

 

Join The Discussion

Your email address will not be published. Required fields are marked *