Step 3.4: Optional SDK methods

Adding Tags

By subscribing to a tag you can create segments and target notifications to your devices subscribed to those tags.

sdk?.subscribeTag(tag: "YourTagHere")
[sdk subscribeTagTo: @"YourTagHere"];

To unsubscribe from a tag

sdk?.unsubscribeTag(tag: "YourTagHere")
[sdk?.unsubscribeTagFrom:@ "YourTagHere"]

Show In-App Notifications (custom triggered)

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 Pushologies portal under the SETTINGS -> API KEYS tab

Methods to set and get the personalisation values.

  1. The below methods are used to set values to existing variables in the local personalisation schema. The local schema will be updated periodically and kept in sync with any variable changes in the Pushologies portal. Please note that if the value that you are trying to set is not part of the local schema then this value will be rejected.

To set multiple values

func updatePersonalisationSchema() {
      let schemaArray =
    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

func updatePersonalisationSchema() {
    do {
        try sdk?.updatePersonalisation(
                schema: PSDKPersonalisationSchema(name: "firstName", value: "Mark")
        isShowingSuccessfulAlert = true
    catch {
        isShowingSuccessfulAlert = false
- (void)updatePersonalisationSchema {
    @try {
        [sdk updatePersonalisationFor:@"firstName" with:@"Mark" error: nil];
        self.isShowingSuccessfulAlert = YES;
    @catch (NSException *exception) {
        self.isShowingSuccessfulAlert = NO;
  1. This method getAllPersonalisations() returns all personalisation keys and values stored locally. This will return empty if there is no schema available or the tenantID is not set while the SDK is initialised.
private var personalisationSchemas: [PSDKPersonalisationSchema]? {
- (NSArray *)personalisationSchemas {
    return [sdk getAllPersonalisationsLegacy];

SDK Event listener.

To receive NOTIFICATION_TAPPED event, access the observer as shown below and choose the event as Pushologies.eventNotificationTapped

sdk?.observeEvent(name: Pushologies.eventNotificationTapped, using: { notification in
    print("AnalyticsEvent: \(String(describing: notification.object))")

[sdk observeEventWithName: Pushologies.eventNotificationTapped using:^(NSNotification * notification) {
     id object = notification.object;
     NSLog(@"AnalyticsEvent: %@", object);

Please note these Notification_Tapped events will not be generated for In-App messages

Force close Push Notification Content.

This method can be used to force close a notification view which is already in the foreground. This will enable the user to view any Deeplink related content within the app when a carousel image or a video button is tapped on. On calling this method, the notification content will be closed and the "viewed" telemetry data will be recorded

[sdk closeNotificationView];  

Please note this method does not work for In-App related contents.


Please remember to test the above methods you have chosen to implement.