Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.4 KB

UserProfile.md

File metadata and controls

58 lines (39 loc) · 1.4 KB

UserProfile API Usage

This document details all the APIs provided by UserProfile, along with sample code snippets on how to properly use the APIs.

For more in-depth information about the UserProfile extension, visit the SDK documentation on UserProfile.

API Usage

Update user attributes:
Swift
UserProfile.updateUserAttributes(attributeDict: ["username": "Will Smith", "usertype": "Actor"])
Objective-C
NSMutableDictionary *profileMap = [NSMutableDictionary dictionary];
[profileMap setObject:@"username" forKey:@"will_smith"];
[profileMap setObject:@"usertype" forKey:@"Actor"];
[AEPMobileUserProfile updateUserAttributesWithAttributeDict:profileMap];
Remove user attributes:
Swift
UserProfile.removeUserAttributes(attributeNames: ["itemsAddedToCart"])
Objective-C
[AEPMobileUserProfile removeUserAttributesWithAttributeNames:@[@"username", @"usertype"]];
Get user attributes:
Swift
UserProfile.getUserAttributes(attributeNames: ["itemsAddedToCart"]) {
  attributes, error in
  // your customized code
}
Objective-C
[AEPMobileUserProfile getUserAttributesWithAttributeNames:@[@"username", @"usertype"] completion:^(NSDictionary* dict, NSError* error){
    // your customized code
    }];