“BrazeiOSSDK
Documentation for the Braze iOS SDK
 All Classes Functions Properties
Instance Methods | Properties | List of all members
ABKUser Class Reference

#import <ABKUser.h>

Instance Methods

(BOOL) - addAlias:withLabel:
 
(BOOL) - setGender:
 
(BOOL) - setEmailNotificationSubscriptionType:
 
(BOOL) - setPushNotificationSubscriptionType:
 
(BOOL) - setCustomAttributeWithKey:andBOOLValue:
 
(BOOL) - setCustomAttributeWithKey:andIntegerValue:
 
(BOOL) - setCustomAttributeWithKey:andDoubleValue:
 
(BOOL) - setCustomAttributeWithKey:andStringValue:
 
(BOOL) - setCustomAttributeWithKey:andDateValue:
 
(BOOL) - unsetCustomAttributeWithKey:
 
(BOOL) - incrementCustomUserAttribute:
 
(BOOL) - incrementCustomUserAttribute:by:
 
(BOOL) - addToCustomAttributeArrayWithKey:value:
 
(BOOL) - removeFromCustomAttributeArrayWithKey:value:
 
(BOOL) - setCustomAttributeArrayWithKey:array:
 
(BOOL) - setLastKnownLocationWithLatitude:longitude:horizontalAccuracy:
 
(BOOL) - setLastKnownLocationWithLatitude:longitude:horizontalAccuracy:altitude:verticalAccuracy:
 
(BOOL) - addLocationCustomAttributeWithKey:latitude:longitude:
 
(BOOL) - removeLocationCustomAttributeWithKey:
 

Properties

NSString * firstName
 
NSString * lastName
 
NSString * email
 
NSDate * dateOfBirth
 
NSString * country
 
NSString * homeCity
 
NSString * language
 
NSString * phone
 
NSString * userID
 
NSString * avatarImageURL
 
ABKFacebookUserfacebookUser
 
ABKTwitterUsertwitterUser
 
ABKAttributionDataattributionData
 

Detailed Description

When setting the custom attributes with custom keys:

  1. The maximum key length is 255 characters; longer keys are truncated.
  2. The maximum length for a string value in a custom attribute is 255 characters; longer values are truncated.

Method Documentation

- (BOOL) addAlias: (NSString *)  alias
withLabel: (NSString *)  label 

Adds an an alias for the current user. Individual (alias, label) pairs can exist on one and only one user. If a different user already has this alias or external user id, the alias attempt will be rejected on the server.

Parameters
aliasThe alias of the current user.
labelThe label of the alias; used to differentiate it from other aliases for the user.
Returns
Whether or not the alias and label are valid. Does not guarantee they won't collide with an existing pair.
- (BOOL) addLocationCustomAttributeWithKey: (NSString *)  key
latitude: (double)  latitude
longitude: (double)  longitude 

Adds the location custom attribute for the user.

Parameters
keyThe custom attribute key
latitudeThe latitude of the location in degrees, the number should be in the range of [-90, 90]
longitudeThe longitude of the location in degrees, the number should be in the range of [-180, 180]
- (BOOL) addToCustomAttributeArrayWithKey: (NSString *)  key
value: (NSString *)  value 

Adds the string value to a custom attribute string array specified by the key. If you add a key that has not previously been set, a custom attribute string array will be created containing the value.

Parameters
keyThe custom attribute key
valueA string to be added to the custom attribute string array
Returns
YES if the operation was successful
- (BOOL) incrementCustomUserAttribute: (NSString *)  key

Increments the value of an custom attribute by one. Only integer and long custom attributes can be incremented. Attempting to increment a custom attribute that is not an integer or a long will be ignored. If you increment a custom attribute that has not previously been set, a custom attribute will be created and assigned a value of one.

Parameters
keyThe identifier of the custom attribute
Returns
YES if the increment for the custom attribute of given key is saved
- (BOOL) incrementCustomUserAttribute: (NSString *)  key
by: (NSInteger)  incrementValue 

Increments the value of an custom attribute by a given amount. Only integer and long custom attributes can be incremented. Attempting to increment a custom attribute that is not an integer or a long will be ignored. If you increment a custom attribute that has not previously been set, a custom attribute will be created and assigned the value of incrementValue. To decrement the value of a custom attribute, use a negative incrementValue.

Parameters
keyThe identifier of the custom attribute
incrementValueThe amount by which to increment the custom attribute
Returns
YES if the increment for the custom attribute of given key is saved
- (BOOL) removeFromCustomAttributeArrayWithKey: (NSString *)  key
value: (NSString *)  value 

Removes the string value from a custom attribute string array specified by the key. If you remove a key that has not previously been set, nothing will be changed.

Parameters
keyThe custom attribute key
valueA string to be removed from the custom attribute string array
Returns
YES if the operation was successful
- (BOOL) removeLocationCustomAttributeWithKey: (NSString *)  key

Removes the location custom attribute for the user.

Parameters
keyThe custom attribute key
- (BOOL) setCustomAttributeArrayWithKey: (NSString *)  key
array: (nullable NSArray *)  valueArray 

Sets a string array from a custom attribute specified by the key.

Parameters
keyThe custom attribute key
valueArrayA string array to set as a custom attribute. If this value is nil, then Braze will unset the custom attribute and remove the corresponding array if there is one.
Returns
YES if the operation was successful
- (BOOL) setCustomAttributeWithKey: (NSString *)  key
andBOOLValue: (BOOL)  value 
Parameters
keyThe String name of the custom user attribute
valueA boolean value to set as a custom attribute
Returns
whether or not the custom user attribute was set successfully; If not, your key might have been nil or empty, your value might have been invalid (either nil, or not of the correct type), or you tried to set a value for one of the reserved keys. Please check the log for more details about the specific failure you encountered.
- (BOOL) setCustomAttributeWithKey: (NSString *)  key
andDateValue: (NSDate *)  value 
Parameters
keyThe String name of the custom user attribute
valueAn NSDate value to set as a custom attribute
Returns
whether or not the custom user attribute was set successfully; If not, your key might have been nil or empty, your value might have been invalid (either nil, or not of the correct type), or you tried to set a value for one of the reserved keys. Please check the log for more details about the specific failure you encountered.
- (BOOL) setCustomAttributeWithKey: (NSString *)  key
andDoubleValue: (double)  value 
Parameters
keyThe String name of the custom user attribute
valueA double value to set as a custom attribute
Returns
whether or not the custom user attribute was set successfully; If not, your key might have been nil or empty, your value might have been invalid (either nil, or not of the correct type), or you tried to set a value for one of the reserved keys. Please check the log for more details about the specific failure you encountered.
- (BOOL) setCustomAttributeWithKey: (NSString *)  key
andIntegerValue: (NSInteger)  value 
Parameters
keyThe String name of the custom user attribute
valueAn integer value to set as a custom attribute
Returns
whether or not the custom user attribute was set successfully; If not, your key might have been nil or empty, your value might have been invalid (either nil, or not of the correct type), or you tried to set a value for one of the reserved keys. Please check the log for more details about the specific failure you encountered.
- (BOOL) setCustomAttributeWithKey: (NSString *)  key
andStringValue: (NSString *)  value 
Parameters
keyThe String name of the custom user attribute
valueAn NSString value to set as a custom attribute
Returns
whether or not the custom user attribute was set successfully; If not, your key might have been nil or empty, your value might have been invalid (either nil, or not of the correct type), or you tried to set a value for one of the reserved keys. Please check the log for more details about the specific failure you encountered.
- (BOOL) setEmailNotificationSubscriptionType: (ABKNotificationSubscriptionType)  emailNotificationSubscriptionType

Sets whether or not the user should be sent email campaigns. Setting it to unsubscribed opts the user out of an email campaign that you create through the Braze dashboard.

Parameters
emailNotificationSubscriptionTypeenum representing the user's email notifications subscription type.
Returns
YES if the field is set successfully, else NO.
- (BOOL) setGender: (ABKUserGenderType)  gender
Parameters
genderABKUserGender enum representing the user's gender.
Returns
YES if the user gender is set properly
- (BOOL) setLastKnownLocationWithLatitude: (double)  latitude
longitude: (double)  longitude
horizontalAccuracy: (double)  horizontalAccuracy 

Sets the last known location for the user. Intended for use with ABKDisableLocationAutomaticTrackingOptionKey set to YES when starting Braze, so that the only locations being set are by the integrating app. Otherwise, calls to this method will be contending with automatic location update events.

Parameters
latitudeThe latitude of the User's location in degrees, the number should be in the range of [-90, 90]
longitudeThe longitude of the User's location in degrees, the number should be in the range of [-180, 180]
horizontalAccuracyThe accuracy of the User's horizontal location in meters, the number should not be negative
- (BOOL) setLastKnownLocationWithLatitude: (double)  latitude
longitude: (double)  longitude
horizontalAccuracy: (double)  horizontalAccuracy
altitude: (double)  altitude
verticalAccuracy: (double)  verticalAccuracy 

Sets the last known location for the user. Intended for use with ABKDisableLocationAutomaticTrackingOptionKey set to YES when starting Braze, so that the only locations being set are by the integrating app. Otherwise, calls to this method will be contending with automatic location update events.

Parameters
latitudeThe latitude of the User's location in degrees, the number should be in the range of [-90, 90]
longitudeThe longitude of the User's location in degrees, the number should be in the range of [-180, 180]
horizontalAccuracyThe accuracy of the User's horizontal location in meters, the number should not be negative
altitudeThe altitude of the User's location in meters
verticalAccuracyThe accuracy of the User's vertical location in meters, the number should not be negative
- (BOOL) setPushNotificationSubscriptionType: (ABKNotificationSubscriptionType)  pushNotificationSubscriptionType

Sets the push notification subscription status of the user. Used to collect information about the user.

Parameters
pushNotificationSubscriptionTypeenum representing the user's push notifications subscription type.
Returns
YES if the field is set successfully, else NO.
- (BOOL) unsetCustomAttributeWithKey: (NSString *)  key
Parameters
keyThe String name of the custom user attribute to unset
Returns
whether or not the custom user attribute was unset successfully

Property Documentation

- (ABKAttributionData*) attributionData
readwriteatomicstrong

Sets the attribution information for the user. For in apps that have an install tracking integration. For more information, please refer to ABKAttributionData.h.

- (NSString*) avatarImageURL
readwritenonatomiccopy

The User's avatar image URL. This URL will be processed by the server and used in their user profile on the dashboard. (String)

- (NSString*) country
readwritenonatomiccopy

The User's country (String)

- (NSDate*) dateOfBirth
readwritenonatomiccopy

The User's date of birth (NSDate)

- (NSString*) email
readwritenonatomiccopy

The User's email (String)

- (ABKFacebookUser*) facebookUser
readwriteatomicstrong

The User's Facebook account information. For more detail, please refer to ABKFacebookUser.h.

- (NSString*) firstName
readwritenonatomiccopy

The User's first name (String)

- (NSString*) homeCity
readwritenonatomiccopy

The User's home city (String)

- (NSString*) language
readwritenonatomiccopy

The User's language (String)

Language Strings should be valid ISO 639-1 language codes. See https://www.loc.gov/standards/iso639-2/php/code_list.php.

If not set here, user language will be inferred from the device language.

- (NSString*) lastName
readwritenonatomiccopy

The User's last name (String)

- (NSString*) phone
readwritenonatomiccopy

The User's phone number (String)

- (ABKTwitterUser*) twitterUser
readwriteatomicstrong

The User's Twitter account information. For more detail, please refer to ABKTwitterUser.h.