{% tabs %} {% tab title="Android" %}
Sets the user profile attributes key and value and allows you to create or update a user profile attribute.
- If the attribute does not exist, it will be created.
- If the attribute exists, the value will be updated.
- A null attribute value removes the attribute.
public static void updateUserAttribute(String attributeName,
Object attributeValue)You want to update username of a user obtained in the log in page :
UserProfile.updateUserAttribute("username", "Will Smith");Sets the user profile attributes key and value.
Allows you to create/update a batch of user profile attributes:
- String, Integer, Boolean, Double, Array, Map are valid type of user profile attributes.
- We do not allow custom objects to be saved as a
UserProfileattribute. - If the attribute does not exist, it will be created.
- If the attribute already exists, then the value will be updated.
- A null attribute value will remove the attribute.
public static void updateUserAttributes(Map<String, Object> attributeMap)You want to update username, usertype of a user obtained in the log in page :
HashMap<String, Object> profileMap = new HashMap<>();
profileMap.put("username","Will Smith");
profileMap.put("usertype","Actor");
UserProfile.updateUserAttributes(profileMap);{% endtab %}
{% tab title="iOS" %}
Sets the user profile attributes key and value and allows you to create or update a user profile attribute.
Remember the following information:
- If the attribute does not exist, it will be created.
- If the attribute already exists, then the value will be updated.
- A null attribute value will remove the attribute.
+ (void) updateUserAttribute: (nonnull NSString*) attributeName withValue: (nullable NSString*) attributeValue;You want to update username of a user obtained in the log in page:
Here is an example in Objective-C:
[ACPUserProfile updateUserAttribute:@"username" withValue:@"Will Smith"];
Here is an example in Swift:
ACPUserProfile.updateUserAttribute("username", withValue: "Will Smith");Sets the user profile attributes key and value.
Allows to create/update a batch of user profile attributes:
- String, Integer, Boolean, Double, Array, Map are valid type of user profile attributes.
- We do not allow custom objects to be saved as a
UserProfileattribute. - If the attribute already exists, then the value will be updated.
- If the attribute does not exist, it will be created.
A null attribute value will remove the attribute.
+ (void) updateUserAttributes: (nonnull NSDictionary*) attributeMap
You want to update username, usertype of a user obtained in the log in page :
Here is an example in Objective-C:
NSMutableDictionary *profileMap = [NSMutableDictionary dictionary];
[profileMap setObject:@"username" forKey:@"will_smith"];
[profileMap setObject:@"usertype" forKey:@"Actor"];
[ACPUserProfile updateUserAttributes:profileMap];Here is an example in Swift:
var profileMap = [AnyHashable: Any]()
profileMap["username"] = "will_smith"
profileMap["usertype"] = "Actor"
ACPUserProfile.updateUserAttributes(profileMap){% endtab %} {% endtabs %}
Removes the given attribute name.
{% tabs %} {% tab title="Android" %}
Removes the user profile attribute for the given key.
public static void removeUserAttribute(String attributeName)A retail appilication wants to remove the itemsAddedToCart user data after the product is purchased.
UserProfile.removeUserAttribute("itemsAddedToCart");{% endtab %}
{% tab title="iOS" %}
Removes the user profile attribute for the given key.
+ (void) removeUserAttribute: (nonnull NSString*) keyRetail appilication wants to remove the itemsAddedToCart user data after the product is purchased.
Here is an example in Objective-C:
[ACPUserProfile removeUserAttribute:@"itemsAddedToCart"];Here is an example in Swift:
ACPUserProfile.removeUserAttribute("itemsAddedToCart");{% endtab %} {% endtabs %}