Performing an attributes operation is done by using the attributes client that can be created from the MCEAttributesQueueManager class. 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.


@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.

Go Back to the Mobile App Messaging home page.

2 comments on"Advanced Mobile App Messaging attributes for iOS"

  1. I’ve used the set attributes of the MCEAttributesQueueManager and it didn’t work:

    MCEAttributesQueueManager.sharedInstance().setUserAttributes([“foo” : “bar”])

    There’s no log of error, and there’s no completion handler.

    In the other hand, this implementation succeeds
    MCEAttributesClient().setUserAttributes([“foo” : “bar”], completion: { (error) in
    if let error = error {
    debugPrint(“Fail! \(error)”)


    Any idea why the first one doesn’t work?

    • JoanGriffin July 13, 2017


      The issue might not be that it didn’t work but that the callback handler is sent as a NSNotification message.
      It’s sent to NSNotificationCenter as “SetUserAttributesError” when there is a temporary error and as “SetUserAttributesSuccess” when it succeeds. If there is a temp issue, it will retry until it succeeds, so no need to send it again if the SetUserAttributesError message is received.

Join The Discussion

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