You can add custom strings, numbers and date variables. The information you set on each user can later be used to segment the users and create personalized dynamic push messages.

Custom attributes is possible to create from Mapp Engage platform, and the key for attribute will be the name you choose, please take a look at images:



For example:

[[Appoxee shared] setDateValue:[NSDate date] forKey:@"key" withCompletionHandler:^(NSError * _Nullable appoxeeError, id _Nullable data) {

	if (!appoxeeError) {

		// Operation was successful.
	}
}];

[[Appoxee shared] setNumberValue:@(1.01) forKey:@"key" withCompletionHandler:^(NSError * _Nullable appoxeeError, id _Nullable data) {

	if (!appoxeeError) {

		// Operation was successful.
	}
}];

[[Appoxee shared] incrementNumericKey:@"key" byNumericValue:@(1.6) withCompletionHandler:^(NSError * _Nullable appoxeeError, id _Nullable data) {

	if (!appoxeeError) {

		// Operation was successful.
	}
}];

[[Appoxee shared] setStringValue:@"string" forKey:@"key" withCompletionHandler:^(NSError * _Nullable appoxeeError, id _Nullable data) {

	if (!appoxeeError) {

		// Operation was successful.
	}
}];

[[Appoxee shared] fetchCustomFieldByKey:@"CustomFieldKey" withCompletionHandler:^(NSError *appoxeeError, id data) {

	if (!appoxeeError && [data isKindOfClass:[NSDictionary class]]) {

		NSDictionary *dictionary = (NSDictionary *)data;
		NSString *key = [[dictionary allKeys] firstObject];
		id value = dictionary[key]; // can be of the following types: NSString || NSNumber || NSDate
	}

	// If there wan't an error, and data object is nil, then value doesn't exist on the device.
}];
 Appoxee.shared()?.setDateValue(NSDate(), forKey: "key", withCompletionHandler: { (appoxeeError, data) in
    
    if appoxeeError == nil {
     
        // Operation was successful.
    }
})

Appoxee.shared()?.setNumberValue(2, forKey: "key", withCompletionHandler: { (appoxeeError, data) in
    
    if appoxeeError == nil {
        
        // Operation was successful.
    }
})

Appoxee.shared()?.incrementNumericKey("key", byNumericValue: 1, withCompletionHandler: { (appoxeeError, data) in
    
    if appoxeeError == nil {
        
        // Operation was successful.
    }
})

Appoxee.shared()?.setStringValue("string", forKey: "key", withCompletionHandler: { (appoxeeError, data) in
    
    if appoxeeError == nil {
        
        // Operation was successful.
    }
})

Appoxee.shared()?.fetchCustomFieldByKey("key", withCompletionHandler: { (appoxeeError, data) in
    
    if appoxeeError == nil {
        
        if let dictionary = data as? NSDictionary {
            
            if let key = data?.allKeys.first {
                
                let value = dictionary.objectForKey(key)
            }
        }
    }
    
    // If there wan't an error, and data object is nil, then value doesn't exist on the device.
})
//Set string, numeric & date as attribute. Pass key for attribute name
public RequestStatus setAttribute(String key, String stringValue)
public RequestStatus setAttribute(String key, Number numericValue)
public RequestStatus setAttribute(String key, Date dateValue)
  
//use this syntax to set custom attribute
Appoxee.instance().setAttribute(key, value)



//Pass key, which you use to set attribute
public String getAttributeStringValue(String key)
  
//usse this syntax to get custom attribute
Appoxee.instance().getAttributeStringValue(key)