By subscribing to a tag you can create segments and target notifications to your devices subscribed to those tags.
sdk?.subscribeTag(tag: "YourTagHere")
To unsubscribe from a tag
sdk?.unsubscribeTag(tag: "YourTagHere")
By calling this method and passing the custom event identifier string as parameter, the app will show any active in-app notification pending in the app.
sdk?.showInAppNotification(with: "YourCustomIdentifierHere")
[sdk showInAppNotificationWith: @"YourCustomIdentifierHere"]
The TENANT_ID will be passed in when the SDK is initialised. Failing to add this parameter would mean that the Personalisation values cannot be set and processed by the SDK.
Where to find the TENANT_ID?
It can be copied from the Notivera portal under the SETTINGS -> API KEYS tab
To set multiple values
func updatePersonalisationSchema() {
let schemaArray =
"""
[{"name":"FirstName","value":"Mark"},{"name":"LastName","value":"Anthony"},{"name":"Key3","value":"Value3"}]
"""
do {
let schema = try JSONDecoder().decode([PSDKPersonalisationSchema].self, from: Data(schemaArray.utf8))
try sdk?.updatePersonalisationVariables(schema: schema)
let data = sdk?.getAllPersonalisations()
dump (data)
} catch {
}
}
- (void)updatePersonalisationSchemaArray {
NSString* schemaArray = @"[{\"name\":\"FirstName\",\"value\":\"Mark\"}]";
NSData* data = [schemaArray dataUsingEncoding: NSUTF8StringEncoding];
NSArray *jsonArray = (NSArray *)[NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
[sdk updatePersonalisationVariablesFor:jsonArray error:nil];
NSArray* getAll = [sdk getAllPersonalisationsLegacy];
NSLog(@"%@", getAll);
}
To set a single value