This website is no longer maintained. Please, visit documentation.indigitall.com to read our updated documentation.

iOS SDK

advanced guide to configure the iOS SDK

Index

1. Configurable properties

In this section you will find a series of more advanced functionalities that require a more complex development. We recommend that a developer be in charge of this configuration.

1.1. Activate geolocated notifications

The indigitall SDK can manage the user's location. This allows you to use the location filters on the send push campaign screen ( Campaigns> Push> New push campaign > Filters> Geographical filters)


Location path on console

Once we have enabled this functionality, the end user will have to give their consent to the location permission and enable the location services of their smartphone, so that the application can obtain the exact location of the user.


Add the following keys to the application's Info.plist file.


<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Can we always use your location?</string>

<key>NSLocationAlwaysUsageDescription</key>
<string>Can we always use your location?</string>

<key>NSLocationWhenInUseUsageDescription</key>
<string>Can we use your location when using the apps?</string>


The NSLocationAlwaysUsageDescription, NSLocationWhenInUseUsageDescription, and NSLocationAlwaysAndWhenInUseUsageDescription keys can be customized by editing the content of the tag.

Options to keep in mind

There are two ways to manage location permissions:

  • Manual:It is the default option and the developer is in charge of managing the location permissions.
  • Automatic: It is the SDK that manages the location permissions.


Here we explain how to configure location permissions in automatic mode.


The locationPermissionMode parameter must be added when the SDK is initialized. This is done using the following code excerpt:


let config = INConfig(appKey: "<YOUR-APP-KEY>")
config.locationPermissionMode = .automatic
Indigitall.initialize(with: config, onIndigitallInitialized: nil, onErrorInitialized: nil);
INConfig *config;
config.appKey = @"<YOUR-APP-KEY>";
config.locationPermissionMode = PermissionModeAutomatic;
[Indigitall initializeWithConfig:config onIndigitallInitialized:nil onErrorInitialized:nil];

1.2. Associate the device with a user

You can associate your own ID to each device. In this way it will be easier and more intuitive for you to work with our tool. For example:

  • If your users have been identified, you could use your user ID, or email, or any other data that you are used to working with.
  • If your users are anonymous because they have not logged into the app, you may have a Google Analytics or Commscore metric system. You could use the ID provided by these tools.


To make this association between your custom ID (externalId), and the identifier handled by indigitall (deviceId), you have to invoke the setExternalCode method:


//Remember to put your external code here
Indigitall.setExternalCode("", onSuccess: { (device) in
        //DO SOMETHING
    }) { (error) in
        //LOG ERROR
    }
//Remember to put your external code here
[IndigitallObjc setExternalCodeWithCode:@"YOUR_EXTERNAL_ID" 
    success:^(INDevice *device) {
        //DO SOMETHING
    } failed:^(INError* error){
        //LOG ERROR
    }];


Do not you worry about anything. Your IDs are irreversibly encrypted on the phone itself and sent securely to our servers. Not even the indigitall team can know this information.

1.3. WiFi filter

If it is required to collect the user's WiFi information, in addition to the configuration of the Indigitall panel, you must add the Access WiFi Information option in the project options, in Signing & Capabilities:


Access WiFi Information


And add the parameter wifiFilterEnabled when the SDK is initialized:


let config = INConfig(appKey: "<YOUR-APP-KEY>")
config.wifiFilterEnabled = true
Indigitall.initialize(with: config, onIndigitallInitialized: nil, onErrorInitialized: nil);
INConfig *config;
config.appKey = @"<YOUR-APP-KEY>";
config.wifiFilterEnabled = true
[Indigitall initializeWithConfig:config onIndigitallInitialized:nil onErrorInitialized:nil];


  • The location permission must be accepted by the user

  • Please note that the WiFi scan time when the app is in the background or closed may be inaccurate.


1.4. Custom domain

If you are ENTERPRISE CLIENT you have to add this parameter in the configuration so that the SDK points to the correct environment:


let config = INConfig(appKey: "<YOUR-APP-KEY>")
config.domain = "YOUR_DEVICE_API_DOMAIN"
config.domainInApp = "YOUR_INAPP_API_DOMAIN"
config.domainInbox = "YOUR_INBOX_API_DOMAIN"
Indigitall.initialize(with: config, onIndigitallInitialized: nil, onErrorInitialized: nil);
INConfig *config = [[INConfig alloc]initWithAppKey:@"<YOUR-APP-KEY>"];
config.domain = "YOUR_DEVICE_API_DOMAIN"
config.domainInApp = "YOUR_INAPP_API_DOMAIN"
config.domainInbox = "YOUR_INBOX_API_DOMAIN"
[Indigitall initializeWithConfig:config onIndigitallInitialized:nil onErrorInitialized:nil];


2. Callbacks offered by the SDK

Our SDK offers various callbacks that help you have greater control of the execution flow and implement custom behaviors.


To subscribe to these callbacks you have to:

  • Pass the functions as parameters on initialization.


Indigitall.initialize(withAppKey: "<YOUR_APP_KEY>", onIndigitallInitialized: { (permissions, device) in
        //DO SOMETHING
    }) { (error) in
        //LOG ERROR
    }
[Indigitall initializeWithAppKey:@"<YOUR_APP_KEY>" onIndigitallInitialized:^(NSArray<INPermissions *> * _Nonnull permissions, INDevice * _Nonnull device) {
         //DO SOMETHING
    } onErrorInitialized:^(INError * _Nonnull onError) {
        //LOG ERROR
    }];

2.1. Initialized SDK

The onIndigitallInitialized method will run when the SDK finishes initializing and the device is ready to receive notifications from indigitall.


Receive as parameter:

  • An array of String. The first item is the status of the claims permission. The second item is the status of the locate permission.
  • A device object with the information associated with the device.


Here we show you an element that prints logs about the status of permissions and device information.


Indigitall.initialize(appKey: "<YOUR_APP_KEY>", 
    onIndigitallInitialized: { (permission, device) in
        print("onIndigitallInitialized Push \(permissions[0].permissionType) permission: \(permissions[0].permissionStatus)")
        print("onIndigitallInitialized Location \(permissions[0].permissionType) permission: \(permissions[1].permissionStatus)")
        print("onIndigitallInitialized DEVICE: \(device.deviceID )")
    }, onErrorInitialized: { (error) in
        //LOG ERROR
    }
[Indigitall initializeWithAppKey:@"<YOUR_APP_KEY>" onIndigitallInitialized:^(NSArray<INPermissions *> * _Nonnull permissions, INDevice * _Nonnull device) {
        NSLog(@"onIndigitallInitialized Device: %@",device.deviceID);
        NSLog(@"onIndigitallInitialized Permission push: %u : %u", permissions[0].permissionType, permissions[0].permissionStatus );
        NSLog(@"onIndigitallInitialized Permission location: %u: %u",permissions[1].permissionType, permissions[1].permissionType)
    } onErrorInitialized:^(INError * _Nonnull onError) {
        //LOG ERROR
    }];

2.2. New registered device

The onNewUserRegistered method will be executed when the device has been assigned the push token to receive notifications, that is, in the first execution of the app after being installed and after having accepted permissions. This is defined in the AppDelegate as callback of the call to the setDeviceToken described above


It receives as a parameter the Device object with the information associated with the device.


Indigitall.setDeviceToken(deviceToken) { (token) in
    print("NewUserRegistered: \(token)")
}
[Indigitall setDeviceToken:deviceToken onNewUserRegistered:^(INDevice * _Nonnull device) {
        NSLog(@"Device: %@",device);
    }];

2.3. An error has occurred

The onErrorInitialized method will be executed only if an error occurs during the initialization of the SDK.


It receives the error description as a parameter.


Indigitall.initialize(appKey: "<YOUR_APP_KEY>", 
    onIndigitallInitialized: { (permission, device) in
        //DO SOMETHING
    }, onErrorInitialized: { (error) in
        print("ERROR: \(error.message)")
    }
[Indigitall initializeWithAppKey:@"<YOUR_APP_KEY>" onIndigitallInitialized:^(NSArray<INPermissions *> * _Nonnull permissions, INDevice * _Nonnull device) {
        //DO SOMETHING    
     } onErrorInitialized:^(INError * _Nonnull onError) {
        NSLog(@"Error Initialized: %@",onError);
    }];

3. Manage device

3.1. Check device information and status

You can use the getDevice method to get the information that the SDK has recorded regarding the device.


The callback of this method will receive as a parameter the device object that contains all the information associated with the device.


Indigitall.getDeviceWith(onSuccess: { (device) in
        print("Device: \(device.deviceID ?? "")\nStatus: \(device.enabled ?? false)")
    }, onError: { (error) in
        print("Error: \(error.message)")
    })
[Indigitall getDeviceWithOnSuccess:^(INDevice * _Nonnull device) {
        NSLog(@"DEVICE: %@ \nStatus: %d", device.deviceID, device.enabled);
    } onError:^(INError * _Nonnull error) {
        NSLog(@"ERROR: %@", error.message);
    }];

3.2. Enable/disable device

You can choose to disable the device to block the receipt of notifications. It is a very useful method to:

  • Implement a preferences screen so that the user can enable / disable the receipt of notifications.
  • Avoid receiving notifications if the user has not logged in, or has not accepted the terms of use, etc.
  • Manage the Robinson List .


To do this, you have the enableDevice and disableDevice methods.


The callback of these methods will receive as a parameter the device object that contains all the information associated with the device.


Indigitall.enableDeviceWith(onSuccess: { (device) in
        print("Device: \(device.deviceID ?? "")\nStatus: \(device.enabled ?? false)")
    }, onError: { (error) in
        print("Error: \(error.message)")
    })

Indigitall.disableDeviceWith(onSuccess: { (device) in
        print("Device: \(device.deviceID ?? "")\nStatus: \(device.enabled ?? false)")
    }) { (error) in
        print("Error: \(error.message)")
    }
[Indigitall enableDeviceWithOnSuccess:^(INDevice * _Nonnull device) {
        NSLog(@"Device: %@ \nStatus: %d",device.deviceID,device.enabled);
    } onError:^(INError * _Nonnull error) {
        NSLog(@"ERROR: %@", error.message);
    }];

[Indigitall disableDeviceWithOnSuccess:^(INDevice * _Nonnull device) {
        NSLog(@"Device: %@ \nStatus: %d",device.deviceID,device.enabled);
    } onError:^(INError * _Nonnull error) {
        NSLog(@"ERROR: %@", error.message);
    }];

4. Interest groups

Our SDK allows you to classify users into different customizable groups. This is very useful for:

  • Implement a preferences screen so that the user can choose the topics for which they want to receive notifications.
  • Label according to the navigation or actions that the user performs.
  • Segment communications according to whether the user has identified or is anonymous.
  • Segment based on language, culture, customer category, or based on any other criteria you need.


Remember that you must first define the groups you want to work with in the indigitall console ( Tools> Interest groups </ a>). See our user manual for more info.

4.1. List groups

Use the topicsList method to get the list of groups that are configured in your indigitall project. The callback of this method receives as a parameter an array of INTopics, which contains the information of all the available groups, as well as a flag that indicates whether the user is included in any of them.


Indigitall.topicsListWith(onSuccess: { (topics) in
        print("TOPICS: \(topics)")
    }) { (error) in
        print("Error: \(error.message)")   
    }
[Indigitall topicsListWithOnSuccess:^(NSArray<INTopic *> * _Nonnull topics) {
        NSLog(@"TOPICS: %@",topics);
    } onError:^(INError * _Nonnull error) {
        NSLog(@"ERROR: %@", error.message);
    }];

4.2. Manage subscription

To manage the device subscription to one or more groups, there are two methods: subscribe and unsubscribe .

Optionally, both receive a TopicsCallback object as the third parameter, which will return the list of all Topic in the project.


Indigitall.topicsSubscribe(withTopic: [Topic.code, Topic.code], onSuccess: { (topics) in
        self?.topics = topics
    }) { (error) in
        print(error.message)
    }

Indigitall.topicsUnSubscribe(withTopic: [Topic.code, Topic.code], onSuccess: { (topics) in
        self?.topics = topics
    }) { (error) in
        print(error.message)
    }
[Indigitall topicsSubscribeWithTopic:@[Topic[0], Topic[1]] onSuccess:^(NSArray<INTopic *> * _Nonnull topics) {
        topics = topics.self;
    } onError:^(INError * _Nonnull error) {
        NSLog(@"ERROR: %@", error.message);
    }];
[Indigitall topicsUnSubscribeWithTopic:@[Topic[0], Topic[1]] onSuccess:^(NSArray<INTopic *> * _Nonnull topics) {
        topics = topics.self;
    } onError:^(INError * _Nonnull error) {
        NSLog(@"ERROR: %@", error.message);
    }];

5. Send custom events

Your app can send information to indigitall's servers to identify the actions and events that happen in it. This allows you to automate retargeting actions.


To register these events, call the sendCustomEvent method, passing a descriptive ID as a parameter (you can invent the one you like the most) and set data you need.


Indigitall.sendCustomEvent("YOUR_CUSTOM_EVENT", customData: []) {
   // Do something in success function
} onError: { (error) in
    //ERRROR DO SOMETHING
}
[Indigitall sendCustomEvent:@"" customData:@[] onSuccess:^{
// Do something in success function
} onError:^(INError * _Nonnull error) {
//ERROR DO SOMETHING
}];

6. In-App Messages

If you want to integrate the In-App messages in your application, you can do it with several complementary formats:

  • Banner. Static content that is always visible, but allows the user to continue using the application.
  • Popup. Full screen content that forces the user to click or discard the information.

6.1. Banner format

Below we tell you how to instantiate one or more In-App messages in banner format.

Remember that you should first have them defined in the indigitall console. See our user manual for more info.

6.1.1. One single banner

Create a UIView view on your storyboard. The size must match what you have defined in the indigitall console ( Tools> In-App / In-Web Schemas ). Remember to translate the units from PX to iOS points.

@IBOutlet weak var myBanner: UIView!
@property (weak, nonatomic) IBOutlet UIView *myBanner;


Instantiate In-App messages using the showInApp method.


Indigitall.show(inApp: "myBanner_CODE", view: myBanner) { actions in
    print("Did touch with actions")
} onShowTimeFinished: { inApp, showTime) in
    //DO SOMETHING
} didExpired: { inApp, error in
    //DO SOMETHING
} didShowMoreThanOnce: { inApp, error in
    //DO SOMETHING
} didClickOut: { inApp, error in
    //DO SOMETHING
} success: { inApp in
    //DO SOMETHING
} failed: { error in
    // LOG ERROR
}

[Indigitall showInApp:myBanner_CODE view:myBanner didTouchWithAction:(INInAppAction *action^{
    // DO SOMETHING    
} onShowTimeFinished:^(INInApp * _Nonnull inApp, int showTime) {
    // DO SOMETHING    
} didExpired:^(INInApp * _Nonnull inApp, INError * _Nonnull error) {
    // DO SOMETHING    
} didShowMoreThanOnce:^(INInApp * _Nonnull inApp, INError * _Nonnull error) {
    // DO SOMETHING    
} didClickOut:^(INInApp * _Nonnull inApp, INError * _Nonnull error) {
    // DO SOMETHING    
} success:^(INInApp * _Nonnull) {
    // DO SOMETHING    
} failed:^(INError * _Nonnull error) {
    // LOG ERROR
}];

6.1.2. Multiple banner

Create multiple views of UIView on your storyboard. The size must match what you have defined in the indigitall console ( Tools> In-App / In-Web Schemas ). Remember to translate the units from PX to iOS points.


    @IBOutlet weak var viewBanner: UIView!
    @IBOutlet weak var viewBannerTwo: UIView!
    @IBOutlet weak var viewBannerThree: UIView!
    ...
    @property (weak, nonatomic) IBOutlet UIView *viewBanner;
    @property (weak, nonatomic) IBOutlet UIView *viewBannerTwo;
    @property (weak, nonatomic) IBOutlet UIView *viewBannerThree;
    ...


Create an array of the views and codes of the inApp that you define in the console and instantiate the In-App messages using the showMultipleInApp method.


    var viewList = [UIView]()
    viewList.append(viewBanner)
    viewList.append(viewBannerTwo)
    viewList.append(viewBannerThree)

    var webViewCodes = [String]()
    webViewCodes.append("myInApp_code_banner")
    webViewCodes.append("myInApp_code_banner_two")
    webViewCodes.append("myInApp_code_banner_three")

Indigitall.showMultiple(inApp: webViewCodes, listView: viewList) { inApp, view, action in
        print("INAPP didTouch: \(inApp.inAppId) y vista: \(view)")
    } onShowTimeFinished: { (inApp, view, showTime) in
        print("INAPP onShowTimeFinished: \(inApp.inAppId) y vista: \(view) en \(showTime)ms")
        view.isHidden = true
    } didExpired: { inApp, error in
        print("INAPP didExpired: \(inApp.inAppId) error: \(error.message)")
    } didShowMoreThanOnce: { inApp, error in
        print("INAPP didShowMoreThanOnce: \(inApp.inAppId) error: \(error.message)")
    } didClickOut: { inApp, error in
        print("INAPP didClickOut: \(inApp.inAppId) error: \(error.message)")
    } success: { inApp, view in
        print("INAPP success: \(inApp.inAppId) y vista: \(view)")
    } failed: { error in
        print("ERROR: \(error.message)")
    }
   NSMutableArray <UIView *> *viewList;
    [viewList addObject:yourCustomView];
    [viewList addObject:yourCustomViewTwo];
    [viewList addObject:yourCustomViewThree];

    NSMutableArray <NSString *> *webViewCodes;
    [webViewCodes addObject:@"myInApp_code_banner"];
    [webViewCodes addObject:@"myInApp_code_banner_two"];
    [webViewCodes addObject:@"myInApp_code_banner_three"]; 

    [Indigitall showMultipleInApp:webViewCodes listView:viewList didTouch:^(INInApp * _Nonnull inApp, UIView * _Nonnull webView, INInAppAction *action) {
        // DO SOMETHING
    } onShowTimeFinished:^(INInApp * _Nonnull inApp, UIView * _Nonnull webView, int showtime) {
        // DO SOMETHING
    } didExpired:^(INInApp * _Nonnull inApp, INError * _Nonnull error) {
        // DO SOMETHING
    } didShowMoreThanOnce:^(INInApp * _Nonnull inApp, INError * _Nonnull error) {
        // DO SOMETHING
    } didClickOut:^(INInApp * _Nonnull inApp, INError * _Nonnull error) {
        // DO SOMETHING
    } success:^(INInApp * _Nonnull inapp, UIView * _Nonnull view) {
        // DO SOMETHING
    } failed:^(INError * _Nonnull error) {
        // LOG ERROR
    }];
}];

6.2. Popup Format

Here we tell you how to instantiate an In-App message in popup format.

Remember that you should first have it defined in the indigitall console. See our user manual for more info.


Create a WebView view in your layouts. The size must match what you have defined in the indigitall console ( Tools> In-App / In-Web Schemas ). Remember to translate the units from PX to iOS points.


Indigitall.showPopup("myInApp_code_popup", didAppear: {
    // DO SOMETHING
} didCancel: {
    print("Did cancel")
} didTouchWithAction: {
    print("Did touch")
} didDismissed: {
    print("Did dissmised")
} onShowTimeFinished: { inApp, showTime in
    print("Did onShowtimeFinished \(inApp.inAppId) on \(showTime)ms")
} didExpired: { inApp, error in
    print("Did didExpired")
} didShowMoreThanOnce: { inApp, error in
    print("Did didShowMoreThanOnce")
} didClickOut: { inApp, error in
    print("Did didClickOut")
} didDismissForever: { inApp, error in
    print("Did didDismissForever")
} failed: {error in
    print("Did failed \(error.description) with message: \(error.message)")
} 
[Indigitall showPopup:@"myInApp_code_popup-Inapp" didAppear:^{
        // DO SOMETHING 
    } didCancel:^{
        // DO SOMETHING 
    } didTouchWithAction:^(INInAppAction *action){
        // DO SOMETHING 
    } didDismissed:^{
        // DO SOMETHING 
    } onShowTimeFinished:^(INInApp *inApp, int showTime){
        // DO SOMETHING 
    } didExpired:^(INInApp *inApp, INError *error){
        // DO SOMETHING 
    } didShowMoreThanOnce:^(INInApp *inApp, INError *error){
        // DO SOMETHING 
    } didClickOut:^(INInApp *inApp, INError *error){
        // DO SOMETHING 
    } didDismissForever:^(INInApp *inApp, INError *error){
        // DO SOMETHING 
    } failed:^(INError * _Nonnull error) {
       // LOG ERROR
    }];


If you want to customize the icon to close the Popup, you can do it with the following method to which you can pass a custom UIButton , if you want to use our icon, just pass a null. The closeIconDisabled parameter is in case you don't want to show any icon, setting it to true to hide it or false to show it.


let closeButton = UIButton()
.
.//set UIButton params
.
Indigitall.showPopup("myInApp_code_popup-InApp", closeIcon: closeButton, closeIconDisabled: false) {
        print("Did appear")
    } didCancel: {
        print("Did cancel")
    } didTouchWithAction: { action in
        print("Did didTouchWithAction")
    } didDismissed: {
        print("Did dissmised")
    } onShowTimeFinished: { inApp, showTime in
        print("Did onShowtimeFinished \(inApp.inAppId) on \(showTime)ms")
    } didExpired: { inApp, error in
        print("Did didExpired")
    } didShowMoreThanOnce: { inApp, error in
        print("Did didShowMoreThanOnce")
    } didClickOut: { inApp, error in
        print("Did didClickOut")
    } didDismissForever: { inApp, error in
        print("Did didDismissForever")
    } failed: {error in
        print("Did failed \(error.description) with message: \(error.message)")
    }         
[Indigitall showPopup:@"myInApp_code_popup-InApp", closeIcon: closeButton, closeIconDisabled: false, didAppear:^{
        // DO SOMETHING 
    } didCancel:^{
        // DO SOMETHING 
    } didTouchWithAction:^(INInAppAction *action){
        // DO SOMETHING 
    } didDismissed:^{
        // DO SOMETHING 
    } onShowTimeFinished:^(INInApp *inApp, int showTime){
        // DO SOMETHING 
    } didExpired:^(INInApp *inApp, INError *error){
        // DO SOMETHING 
    } didShowMoreThanOnce:^(INInApp *inApp, INError *error){
        // DO SOMETHING 
    } didClickOut:^(INInApp *inApp, INError *error){
        // DO SOMETHING 
    } didDismissForever:^(INInApp *inApp, INError *error){
        // DO SOMETHING 
    } failed:^(INError * _Nonnull error) {
       // LOG ERROR
    }];

6.3. InApp Utilities

In the event that you want to show the InApp scheme in a different way to how our SDK paints it, we put at your disposal some methods so that you can customize the "painting", without affecting the statistics or the InApp functionalities.

InApp object pickup

InAppHandler.init().getInApp(inAppId) { content, inApp in
    //DO SOMETHING
} errorLoad: { error in
    //Show error
}
[[[InAppHandler alloc]init] getInApp:inAppId success:^(NSString *content, INInApp *inApp) {
    //DO SOMETHING
} errorLoad:^(INError *error) {
    //Show error
}];

Check if the InApp should be displayed

Thanks to the InApp functionalities, it is possible to indicate that the inApp is displayed or pressed a maximum number of times, or if in the case of the popUp, after performing an action , such as pressing the close button, is not shown again. To do this we could do the following within the inAppGet method that we have seen previously:

InAppHandler.init().getInApp(inAppId) { content, inApp in
    if (inApp.properties.dismissForever &&
        InAppUtils.is(inAppDismissForever: inApp)) {
        //Dismiss Forever
    } else {
        InAppUtils.inAppWasShownWith(in: inApp) { inApp, error in
            //did expired
        } didShowMoreThanOnce: { inApp, error in
            //show more than x times
        } didClickOut: { inApp, error in
            //click more than x times
        } onSuccess: {
            //show inApp
        }
    }
} errorLoad: { error in
    //Show error
}
[[[InAppHandler alloc]init] getInApp:inAppId success:^(NSString *content, INInApp *inApp) {
    if (inApp.properties.dismissForever &&
        [InAppUtils isInAppDismissForever:inApp]){
        //Dissmis Forever
    } else {
        [InAppUtils inAppWasShownWithInApp:inApp didExpired:^(INInApp * _Nonnull inApp, INError * _Nonnull error) {
            //did expired
        } didShowMoreThanOnce:^(INInApp * _Nonnull inApp, INError * _Nonnull error) {
            //show more than x times
        } didClickOut:^(INInApp * _Nonnull inApp, INError * _Nonnull error) {
            //click more than x times
        } onSuccess:^{
            //show inApp
        }];
    }
} errorLoad:^(INError *error) {
    //Show error
}];

Actions to count clicks or to not show InApp anymore

For the case of what we call Dismiss Forever, once the action is performed, this method must be called:

InAppUtils.addNewInApp(toDismissForever: inApp)
[InAppUtils addNewInAppToDismissForever: inApp];

To send the statistics in the event that the inApp has been clicked and clicks out control:

InAppUtils.inAppWasTappedWith(inApp)
[InAppUtils inAppWasTappedWithInApp: inApp];


7. Collection of push data

In the event that you would like to obtain the push object of type json to carry out checks or actions that your application requires, we leave you this code that will help to obtain it:



@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
    Indigitall.handle(with: response ,withCompletionHandler: { (push, action) in
        print("Push object:", push)
        print("Push action app:", action.app)
    })
}

//@DEPRECATED
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    print("Push notification received: \(userInfo)")
    let data = userInfo["data"]
    let push = INPush(data as! NSMutableDictionary)
    print("Push object : \(push)")

- (void) userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler{
    [Indigitall handleWithResponse:response withCompletionHandler:^(INPush * _Nonnull push, INPushAction * _Nonnull action) {
        NSLog(@"Push object: %@", push);
        NSLog(@"Push object app: %@", action.app);
    }];
}

//@DEPRECATED
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
    NSLog(@"Push notification received: %@", userInfo);
    NSMutableDictionary *data = userInfo[@"data"];
    INPush *push = [[INPush alloc]init:data];
    NSLog(@"Push object: %@",push);
}

7.1. Register statistics if the Push action is involved.


If you decide to treat the action of the Push independently without going through our SDK, once the push has been collected as explained in the previous section, in the userNotificationCenter: didReceive method of the AppDelegate itself, in order to record the statistics you must add the next method:


Indigitall.registerStatistics(response)
[Indigitall registesStatistics: response];


8. Inbox

8.1. Inbox configuration

In this section you will find a series of more advanced functionalities that require a more complex development. We recommend that a developer be in charge of this configuration.

8.1.1. User identification

In order to get the notifications from Indigitall's Inbox, the user must identify himself. First you have to initialize the SDK of Indigitall so that it generates our identifier (deviceId) and to be able to associate it with the custom ID that you associate to the device, similar to how here.


To perform the registration tasks, these two methods are used:


//User ID
Indigitall.logIn(withId: "YOUR_ID", onSuccess: { (device) in
    //DO SOMETHING  
}) { (error) in
    //LOG ERROR
}

//Disconnection
Indigitall.logOut(success: { (device) in
    //DO SOMETHING  
}, onError: { (error) in
    //LOG ERROR    
})
//User ID
[Indigitall logInWithId:"YOUR_ID" onSuccess:^(INDevice * _Nonnull device) {
    //DO SOMETHING
} onError:^(INError * _Nonnull error) {
    //LOG ERROR
}];

//Disconnection
[Indigitall logOutWithSuccess:^(INDevice * _Nonnull device) {
    //DO SOMETHING
} onError:^(INError * _Nonnull error) {
    //LOG ERROR
}];

8.1.2. Generate authentication token

In this section you will see how to generate a validation token for an application that has configured authentication with webhook. To generate this token, you need to add the JSON with the configuration.


The token has a predetermined expiration date, once it has expired in our system, an event of type 'Protocol' will be launched, which will indicate said expiration and will have to return the configuration JSON. To collect the event, you have to implement it in the corresponding class, and override the following method:


class YOURCLASS: GetAuthConfig

func getAuthConfig() -> [AnyHashable : Any] {
        ...
        return YOUR_JSON
    }
@interface YOURCLASS: NSObject<GetAuthConfig>

- (NSDictionary *) getAuthConfig;

8.2. Inbox main features

Once the device has been successfully registered, you can start making Inbox requests. The following characteristics of the Inbox must be taken into account, which are optionally configurable.

8.2.1. Inbox Properties

The notifications of the Inbox will have the following states of the class InboxStatus :


  • Sent : The notification has been sent to the client, whether or not they could read it.
  • Click: have clicked on the notification displayed in the Inbox.
  • Delete: The Inbox notification has been deleted by the customer.


The notifications will also come with a 'read' status, to help differentiate those status.


Each notification will be assigned with an integer and unique sendingId, to be able to differentiate them and use them for some of the functionalities.

8.2.2. Get notifications

As explained above, to obtain the notifications the following method is used:


Inbox.getInboxWithSuccess({ (inbox) in
  //DO SOMETHING
}) { (error) in
   //LOG ERROR
}
[Inbox getInboxWithSuccess:^(INInbox * _Nonnull inbox) {
    //DO SOMETHING
} onError:^(INError * _Nonnull error) {
    //LOG ERROR
}];
8.2.2.1 Next page

Once the Inbox instance is obtained, we will use it to request the next page, which is made with the following method, in the event that there are no more pages it will indicate it in the error with code 410:


inbox.getNextPage(success: { (inbox, newNotifications) in
    //DO SOMETHING
}) { (error) in
    if (error.statusCode == 410){
        //LOG NO MORE PAGES
    }else{
        //LOG ERROR
    }
}
[inbox getNextPageWithSuccess:^(INInbox * _Nonnull inbox, NSArray<INInboxNotification *>* newNotifications) {
    //DO SOMETHING
} onError:^(INError * _Nonnull error) {
    if (error.statusCode == 410){
        //LOG NO MORE PAGES
    }
    //LOG ERROR
}];


Take into account that the Inbox callback, apart from returning the updated Inbox, returns an array called newNotifications , in which the new notifications to be added to the Inbox will be displayed, so that, if necessary, be able to use said array to move between the pages without depending on the Inbox calls.

8.2.3. Get the information from a notification

To get the information for a particular notification, you have to make the following call with the sendingId of each notification:


inbox.getInfoFromNotification(withSendingId: SENDING_ID, onSuccess: { (inboxnotification) in
    //DO SOMETHING        
}) { (error) in
    //LOG ERROR
}
[inbox getInfoFromNotificationWithSendingId:SENDING_ID onSuccess:^(INInboxNotification * _Nonnull inboxNotification) {
    //DO SOMETHING    
} onError:^(INError * _Nonnull error) {
    //LOG ERROR
}];

8.2.4. Edit the status of one or more notifications

To edit the status of one or more notifications at the same time, it is done with the following method in which you must indicate the sendingIds of the notifications to edit and the status to which you want to change:

//Modify a notification
inbox.modifyStatusFromNotification(withSendingId: SENDING_ID, status: STATUS, onSuccess: { (inboxnotification) in
    //DO SOMETHING  
}) { (error) in
    //LOG ERROR
}

//Massively modify
inbox.massiveEditNotifications(withSendingIdsList: [SENDING_IDS], status: STATUS, onSuccess: {
    //DO SOMETHING
}) { (error) in
    //LOG ERROR
}
//Modify a notification
[inbox modifyStatusFromNotificationWithSendingId:SENDING_ID status:STATUS onSuccess:^(INInboxNotification * _Nonnull inboxNotification) {
  //DO SOMETHING      
} onError:^(INError * _Nonnull error) {
    //LOG ERROR
}];

//Massively modify
[inbox massiveEditNotificationsWithSendingIdsList:[SENDING_IDS] status:STATUS onSuccess:^{
   //DO SOMETHING 
} onError:^(INError * _Nonnull error) {
   //LOG ERROR 
}];

8.2.5. Notifications status counters

To find out the number of notifications in the Inbox according to their status, this method is performed:

Inbox.getMessagesCount(success:  { (counter) in
   //DO SOMETHING  
}) { (error) in
    //LOG ERROR
}
 [Inbox getMessagesCountWithSuccess:^(INInboxCounters * _Nonnull counters) {
    //DO SOMETHING 
} onError:^(INError * _Nonnull error) {
    //LOG ERROR
}];


9. Changelog

[4.15.1] - 03/2022

Fixes

  • Improve the performance of API calls

[4.15.0] - 03/2022

Added

  • Publish to SPM

[4.14.0] - 03/2022

Added

  • Callback inApp Touch with actions on inApp

[4.13.6] - 03/2022

Fixes

  • Utils to be able to show the inApp and control its actions

[4.13.5] - 02/2022

Fixes

  • Re-scale PopUp

[4.13.4] - 01/2022

Fixes

  • Fix Customer updates call

[4.13.3] - 01/2022

Fixes

  • Send SendingId with events click

[4.13.2] - 01/2022

Fixes

  • Add utils to send InApp event

[4.13.1] - 01/2022

Fixes

  • Access to all header classes .h

[4.13.0] - 01/2022

Added

  • InApp Dismiss Forever
  • InApp utilities (numberOfClicks, numberOfShows)
  • Event custom para iurny

[4.12.6] - 12/2021

Fixes

  • Add field to PUT request when push secure is active

[4.12.5] - 12/2021

Fixes

  • Fix inApp's lastVersionId field

[4.12.4] - 11/2021

Fixes

  • Error message in case the InApp is empty

[4.12.3] - 11/2021

Fixes

  • Add campaignId on push click

[4.12.2] - 11/2021

Fixes

  • Do not run the SDK in case of receiving a notification with the app in the background

[4.12.1] - 11/2021

Fixes

  • Register device

[4.12.0] - 10/2021

Added

  • Category field in Inbox notifications

[4.11.4] - 10/2021

Fixes

  • Device disabled

[4.11.3] - 10/2021

Fixes

  • Save device info on first init

[4.11.2] - 10/2021

Fixes

  • Device enabled/disabled

[4.11.1] - 10/2021

Fixes

  • EndPoints of Customer Service

[4.11.0] - 10/2021

Added

  • Customer Service

[4.10.0] - 09/2021

Added

  • InApp click control

[4.9.3] - 09/2021

Fixes

  • Fix INInApp model

[4.9.2] - 07/2021

Fixes

  • Fix INInApp model numberOfShows

[4.9.1] - 07/2021

Fixes

  • Fix scale of popup by terminal density

[4.9.0] - 05/2021

Added

  • New method to send custom event with data

    Fixes

  • Get Info from devices

[4.8.0] - 05/2021

Added

  • InApp is displayed
  • Hide the inApp after a time configured in the console

[4.7.1] - 04/2021

Fixes

  • PopUp with rounded edges

[4.7.0] - 04/2021

Added

  • InApp show the inApp a number of times configured by console
  • Hide PopUp after a time configured in the console

[4.6.10] - 03/2021

Fixes

  • Improve logs of push actions
  • Method to send click' statistics added
  • fix open wallet

[4.6.9] - 12/2020

Fixes

  • Update UIWebView (Deprecated) by WKWebView

[4.6.8] - 12/2020

Fixes

  • Stability in requests
  • Share action on iPad
  • Show buttons in previous notifications

[4.6.7] - 11/2020

Fixes

  • Fix if push objects come empty through the API.

[4.6.6] - 11/2020

Fixes

  • Fix closure of wifi request application in background

[4.6.5] - 10/2020

Fixes

  • Scale popup and add callbacks

[4.6.4] - 10/2020

Fixes

  • Correct if ExteralCode is null

[4.6.3] - 09/2020

Fixes

  • Scale inapp

[4.6.2] - 09/2020

Fixes

  • Push pickup callback.

[4.6.1] - 08/2020

Fixes

  • LogOut method

[4.6.0] - 08/2020

Added

  • Push with encrypted data

[4.5.2] - 07/2020

Fixes

  • Callback onIndigitallInitialized with no token created
  • Creation of false token in case of using simulator

[4.5.1] - 06/2020

Fixes

  • Refactor error callbacks in inbox

[4.5.0] - 06/2020

Added

  • Inbox

[4.4.0] - 06/2020

Added

  • pen * .pkpass files

[4.3.0] - 05/2020

Added

  • Wifi filter
  • Customizable Popup Close Icon

[4.2.4] - 05/2020

Fixes

  • Last visit event

[4.2.3] - 04/2020

Fixes

  • Popup scale

[4.2.2] - 03/2020

Fixes

  • Device data collection

[4.2.1] - 03/2020

Fixes

  • Popup size and sample time

[4.2.0] - 03/2020

Added

  • InApp Actions

Fixes

  • Location request

[4.1.0] - 03/2020

Added

  • UserCenterNotifification withResponse_ Methods
  • Indigitall Xamarin with simulator architectures

[4.0.4][4.0.5] - 02/2020

Fixes

  • Crash if server down
  • Background status

[4.0.3] - 01/2020

Fixes

  • Crash with topic subscription

[4.0.2] - 01/2020

Fixes

  • Duplicate POST device requests

[4.0.1] - 01/2020

Added

  • IndigitallXamarinLib Library

    Fixes

  • Notifications extension
  • Callback Initialized

[4.0.0] - 01/2020

Fixes

  • Push in background mode
  • CircleCI configuration

[3.1.5][3.1.6] - 11/2019

Fixes

  • CircleCI configuration

[3.1.4] - 11/2019

Fixes

  • Update Xcode version
  • CircleCI configuration

[3.1.2][3.1.3] - 10/2019

Fixes

  • CircleCI configuration

[3.1.1] - 09/2019

Fixes

  • Updated Xcode version
  • Add simulator architectures

[3.1.0] - 08/2019

Added

  • SendCustomEvent method to send custom events