IMIconnect Developer Hub

Welcome to the IMIconnect developer hub. You'll find all the resources to help you get started with IMIconnect quickly. We are here to support you if you get stuck. Let's jump right in!

Get Started

This interface has two classes that handles the SDK initialization and registration. The classes are:

IMIconnect

This class contains the methods to initialize the SDK and register a user. When integrating the SDK into your app, it is mandatory to use this class to initialize the SDK. With exception to the Authentication module, it is also necessary to register a user before other features are used.

startup


This method is used to initialize the SDK. It reads the configuration from the file IMIconnectConfiguration.plist. You can pass an error in parameter, which will be set if any error occurs during the startup process. You need not use this method if you are using the [ICAppDelegate didFinishLaunchingWithOptions:] method.

  Syntax: + (BOOL)startup:(NSError **)error;

  Parameters:

Parameter
Type
Description

error

NSError

Specifies the error description.

startupWithConfig


This method is used to initialize the SDK using the provided configuration options. You can pass an error in parameter, which will be set if something wrong occurs during the startup process.

  Syntax: + (BOOL)startupWithConfig:(ICConfig *)config error:(NSError **)error;

  Parameters:

Parameter
Type
Description

config

Refer to ICConfig class.

error

NSError

Specifies the error description.

  Example:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    ICConfig *config = [[ICConfig alloc] initWithClientKey:@"<Your client key>" forAppId:@"<Your App Id>"];
    NSError *error;
    [IMIconnect startupWithConfig:config error:&error];
    if (error != nil)
    {
        NSLog(@"Start up failed. Error: %@",error.localizedDescription);
    }
  	[super application:application didFinishLaunchingWithOptions:options]
    return YES;
}

shutdown


This method is used to cleanup the SDK, freeing all internal object instances. Invoking this method will stop the SDK features from functioning as such Real Time Messages and Push notifications.

Usage of this method is not required unless there are a few limited cases where you may wish to use it; for example, if you are only using the Authentication or Monitoring features.

registerWithDeviceProfile


This method registers the device profile with the SDK. This method causes profile details to be sent to the IMIconnect platform. Once a profile is registered, all further SDK calls take place in the context of that profile.

  Syntax: (void)registerWithDeviceProfile:(ICDeviceProfile *)deviceProfile completionHandler:(void (^)(NSDictionary *response,NSError *error))completionHandler

ICDeviceProfile *deviceProfile = [[ICDeviceProfile alloc]
initWithDeviceId: [ICDeviceProfile defaultDeviceID]];
[IMIconnect registerWithDeviceProfile:deviceProfile
completionHandler:^(NSDictionary*response, NSError *error)
{
		//Handle the response
}];

deviceProfile


This method retrieves the current registered device profile.

  Syntax: + (ICDeviceProfile *)deviceProfile

isRegistered


This method is used to check whether the user is currently registered with IMIconnect. This method returns true if the user is registered, else false is returned.

  Syntax: + (BOOL)isRegistered;

setPolicyPollingInterval


This method is used to set the interval at which the SDK will poll policy updates in minutes. To prevent adverse affects on battery or CPU usage a minimum interval of 30 minutes is enforced. To disable polling, set the value to 0. If Real Time Messaging or Push is enabled, this value will not be used.

  Syntax: +(void)setPolicyPollingInterval:(NSTimeInterval)interval;

  Parameters:

Parameter
Type
Description

interval

NSTimeInterval

Specifies the time in minutes after which policy updates will happen.

policyPollingInterval


This method is used to get the current policy polling interval, in minutes.

  Syntax: +(NSTimeInterval)policyPollingInterval;

updateDeviceProfileParam


This method updates the device profile parameter identified by ICDeviceProfileParam with a new value.

  Syntax: + (void)updateDeviceProfileParam:(ICDeviceProfileParam)deviceProfileParam withValue:(NSString *)value completionHandler:(void (^)(NSDictionary *response,NSError *error))completionHandler

IMIconnect updateDeviceProfileParam:ICDeviceProfileParamCustomerId
													wirhValue:@"myCustomerId"
                 completionHandler:^(NSDictionary *response,NSError *error)
{
	//Handle the response
}];

deviceProfile


This method retrieves the deviceId used by IMIconnect APIs.

  Syntax: + (ICDeviceProfile *)deviceProfile

Method (Deprecated)
New Method
Description

  +(NSString *)deviceId

  +(ICDeviceProfile *)deviceProfile

Retrieves the deviceId used by IMIconnect APIs.

removeDeviceProfileParam


This method removes the device profile parameter identified by ICDeviceProfileParam with a new value.

  Syntax: + (void)removeDeviceProfileParam:(ICDeviceProfileParam)completionHandler:(void (^)(NSDictionary *response,NSError *error))completionHandler

[IMIconnect removeDeviceProfileParam:ICDeviceProfileParamUserId
									completionHandler:^(NSDictionary *response, NSError *error)
{
	//Handle the response
}];

unregister


This method unregisters the current device profile.

  Syntax: + (void)unregister:(void (^)(NSError *error))completionHandler

sdkVersion


This method retrieves the SDK version number.

  Syntax: + (NSString *)sdkVersion;

  Return Value: Returns the SDK version number.

setSecurityToken


This method is used to set security token to provide better access control for user-centric resources. This method allows developers to specify the Security Token that the SDK will pass to the Gateway API calls.

  Syntax: + (void)setSecurityToken:(NSString *)token;

  Parameters:

Parameter
Type
Description

token

String

Specifies the token which is generated from jwttoken API.

  Example:

        TokenRequest *tokenRequest = [TokenRequest new]; 
        [tokenRequest requestTokenWithUserId:userId 
                                       appId:appId 
                                   expiresIn:self.expirationTime 
                           completionHandler:^(NSString *token, NSError *error) 
         { 
             if (token != nil) 
             { 
                 [IMIconnect setSecurityToken:token]; 
             } 
             if (completionHandler != nil) 
             { 
                 completionHandler(token,error); 
             } 
         }]; 

setSecurityTokenErrorDelegate


This method allows developers to register an object which implements the SecurityTokenExceptionListener interface to listen for Security Token related exceptions which occur from internal (indirect) Gateway API calls.

  Syntax:
+ (void)setSecurityTokenErrorDelegate(id<ICSecurityTokenErrorDelegate>)delegate;

  Example:

[IMIconnect setSecurityTokenErrorDelegate:self]; 

ICDeviceProfile

ICDeviceProfile is a class that gathers information about the back-end device profile. An ICDeviceProfile instance should be instantiated to register a device profile.
The developer can choose to register the device profile with a deviceId only or with a deviceId and an appUserId. User can generate a unique/own device ID or can choose the defaultDeviceId provided by the SDK.
If the user chooses to register a device profile with the deviceId only, the backend will automatically generate an appUserId. The current device profile is accessible via the IMIconnect class.

Property
Description

Indicates if the app user ID has been generated by the system.

Methods
Description

(instancetype)initWithDeviceId:(NSString *)deviceId

Instantiates an ICDeviceProfile with a deviceId.

(instancetype)initWithDeviceId:(NSString *)

deviceId appUserId:(NSString *)appUserId

Instantiates an ICDeviceProfile with a deviceId and an appUserId.

(NSString *)defaultDeviceId

Retrieves the default device ID based on the vendor ID of the device.

ICConfig

This class holds the configuration information that is used to initialize the SDK.

Property
Description

Specifies the app id of the app created in IMIconnect.

Specifies the client key of the app created in IMIconnect.

@property (nonatomic, readonly) NSString *groupIdentifier;

The app group identifier. This group identifier is used to retrieve information between the CoreSDK and the NotificationServiceExtension.

initWithClientKey:withappid:


This method is used to initialize an ICConfig instance with an appId and clientKey.

  Syntax: - (instancetype)initWithClientKey:(NSString *)clientKey forAppId:(NSString *)appId;

  Parameters:

Parameter
Type
Description

appId

NSString

Specifies the app id that is created in IMIconnect.

clientKey

NSString

Specifies the client key that is created in IMIconnect.

  Example:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    ICConfig *config = [[ICConfig alloc] initWithClientKey:@"<Your client key>" forAppId:@"<Your App Id>"];
    NSError *error;
    [IMIconnect startupWithConfig:config error:&error];
    if (error != nil)
    {
        NSLog(@"Start up failed. Error: %@",error.localizedDescription);
    }
    return YES;
}

initWithClientKey:withappid:groupIdentifier

This method is used to initialize an ICConfig instance with an appId, a clientKey and a group identifier.

  Syntax: - (instancetype)initWithAppId:(NSString *)appId clientKey:(NSString *)clientKey groupIdentifier:(NSString *)groupIdentifier;

  Parameters:

Parameter
Type
Description

Appid

NSString

clientKey

NSString

groupidentifier

NSString

ICLogger

setLogType


This method sets the log options for the logger.

  Syntax: + (void)setLogType:(ICLogType)logType forLogTarget:(ICLogTarget)logTarget

  Parameters:

Parameter
Type
Description

logType

ICLogType

The type of logs that will be logged.

target

ICLogTarget

The target on which the logs will be displayed/recorded.

setRetentionDuration


This method sets the retention duration of the logs. The logs will be kept during that duration and will be automatically purged after.

  Syntax: + (void)setRetentionDuration:(NSInteger)days

  Parameters:

Parameter
Type
Description

days

Integer

The number of days after which the logs will be purged.

logPath


This method retrieves the directory path where the logs are stored.

  Syntax: + (NSString *)logPath

  Return Value: Returns the directory path where the logs are stored.

Core


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.