Inherits from NSObject
Declared in Netmera.h

Overview

Netmera is the main class to be used for configuring the SDK and interacting with Netmera servers.

Tasks

Other Methods

  • + start

    Initialize the Netmera instance.

    Netmera does not start operating, it even does not exist in memory, unless this method is called. Any Netmera method called before this method is simply ignored.

  • + setAPIKey:

    Set given Netmera SDK API key.

    Calling this method with a valid API key will effectively start communication with Netmera servers. Netmera will store any operation until it has an API key.

    Setting API key to nil or empty string will stop all network operations, and all pending operations will be stored until a valid API key is set again.

  • + setBaseURL:

    Changes base API URL to given URL string.

    The only use case for this method is when a custom Netmera domain is defined to your application.

  • + setLogLevel:

    Set log level for SDK.

    Default log level is @c NetmeraLogLevelError.

Deprecated Methods

User Methods

  • + updateUser:

    Set or update the attributes of the user in Netmera.

    To send information about your user to Netmera, you should create a @c NetmeraUser object and set the properties of the user object with corresponding values of your user.

    After setup, call this method to send data to Netmera servers.

    In order to remove a previously set attribute from Netmera, you should set an @c [NSNull null] object to the corresponding attribute on user object.

PushNotification Methods

  • + setPushDelegate:

    Set delegate object to be notified about events related to push notification handling.

  • + loadWebViewContentInWebView:

    Load contents of the web view action of recent push notification in given web view.

    When this method is called, Netmera will immediately load the contents of the web view action inside given @c UIWebView object.

  • + recentPushObject

    Get the most recent push object

    You can access to details of the received push notification inside UIApplicationDelegate methods related to push notifications using this method.

  • + requestPushNotificationAuthorizationForTypes:

    Request push notification authorization from user for given notification types.

    Calling this method will trigger OS to present push notification permission dialog to user.

  • + setEnabledReceivingPushNotifications:
  • + isEnabledReceivingPushNotifications
  • + setEnabledPopupPresentation:
  • + enablePopupPresentation

    Enable Netmera to present received popups immediately.

    By default, Netmera presents received popup style notifications automatically.

    Use this method to re-enable Netmera to automatically present popup style notifications if you previously disabled using disablePopupPresentation method.

    If a popup style notification has been received during the time at which popup presentation was disabled, it will be shown immediately after you call this method.

  • + disablePopupPresentation

    Disable Netmera to present received popups.

    By default, Netmera presents received popup style notifications automatically.

    Use this method to disable Netmera to automatically present popup style notifications.

DisableInitialize Methods

Location Methods

  • + requestLocationAuthorization

    Request appropriate location authorization from user.

    Calling this method will trigger OS to present location permission dialog to user. Authorization type to be requested will be determined automatically by the SDK using the following procedure:

    • If location is globally disabled/restricted in Settings, or user has explicitly denied authorization for the application:

      • SDK will try to redirect user to Settings by triggering OS prompt. This will happen only once.
    • If location authorization is not determined by user before:

      • If @c NSLocationAlwaysUsageDescription key is set in Info.plist, always authorization will be requested.

      • Else if @c NSLocationWhenInUseUsageDescription key is set in Info.plist, when in user authorization will be requested.

    • If location authorization type is when in use authorization:

      • If @c NSLocationAlwaysUsageDescription key is set in Info.plist, always authorization will be requested.

Inbox Methods

  • + fetchInboxUsingFilter:completion:

    Fetch list of push notifications matching with given filter from Netmera.

    This method will start the fetch process and return immediately. When fetch process is finished, given completion block will be called with a @c NetmeraInbox object or with an @c NSError object if fetch operation has failed.

    Use returned NetmeraInbox object for future operations on the inbox such as accessing the objects, fetching next pages of the inbox list, and modifying the status of objects.

Event Methods

  • + sendEvent:

    Send an event to Netmera servers.

    You can send behavioral actions of your users using this method.

    Rather than accepting unstructured information inside events, SDK requires given event to be a valid subclass of @c NetmeraEvent class. This approach provides Netmera to verify type of the given event attributes, which is crucial during event analytics operations on Netmera servers.

Class Methods

addUserTags:

+ (void)addUserTags:(NSArray *)tagList

disablePopupPresentation

+ (void)disablePopupPresentation
Discussion

Note: If any popup notification is received during the time at which presentation is disabled, it will be presented immediately after presentation is enabled again.

Declared In

Netmera.h

enablePopupPresentation

+ (void)enablePopupPresentation
Discussion

Note: If multiple popup notifications have been received, only the most recent one will be presented.

Declared In

Netmera.h

fetchInboxUsingFilter:completion:

Fetch list of push notifications matching with given filter from Netmera.

This method will start the fetch process and return immediately. When fetch process is finished, given completion block will be called with a @c NetmeraInbox object or with an @c NSError object if fetch operation has failed.

Use returned NetmeraInbox object for future operations on the inbox such as accessing the objects, fetching next pages of the inbox list, and modifying the status of objects.

+ (void)fetchInboxUsingFilter:(NetmeraInboxFilter *)filter completion:(void ( ^ ) ( NetmeraInbox *inbox , NSError *error ))completionBlock

Parameters

filter

A @c NetmeraInboxFilter object defining the filter options for the list of push objects to be returned from server.

completionBlock

Block to be triggered after fetch process is completed.

See Also

Declared In

Netmera.h

fetchUserTags:

+ (void)fetchUserTags:(void ( ^ ) ( NSArray *tagList ))resultBlock

isEnabledReceivingPushNotifications

+ (BOOL)isEnabledReceivingPushNotifications

loadWebViewContentInWebView:

+ (void)loadWebViewContentInWebView:(UIWebView *)webView
Discussion

Warning: If you need to be notified about UIWebViewDelegate methods, you @b must set your delegate object onto given web view object @b before calling @c -loadWebViewContentInWebView: method.

Warning: This method @b must be called inside -handleWebViewPresentation delegate method.

Parameters

webView

A UIWebView instance upon which related HTML content will be loaded.

Declared In

Netmera.h

new

+ (instancetype)new

recentPushObject

Get the most recent push object

You can access to details of the received push notification inside UIApplicationDelegate methods related to push notifications using this method.

+ (nullable NetmeraPushObject *)recentPushObject

Return Value

NetmeraPushObject Object containing information about the most recent push notification

Declared In

Netmera.h

removeUserTags:

+ (void)removeUserTags:(NSArray *)tagList

requestLocationAuthorization

Request appropriate location authorization from user.

Calling this method will trigger OS to present location permission dialog to user. Authorization type to be requested will be determined automatically by the SDK using the following procedure:

  • If location is globally disabled/restricted in Settings, or user has explicitly denied authorization for the application:

    • SDK will try to redirect user to Settings by triggering OS prompt. This will happen only once.
  • If location authorization is not determined by user before:

    • If @c NSLocationAlwaysUsageDescription key is set in Info.plist, always authorization will be requested.

    • Else if @c NSLocationWhenInUseUsageDescription key is set in Info.plist, when in user authorization will be requested.

  • If location authorization type is when in use authorization:

    • If @c NSLocationAlwaysUsageDescription key is set in Info.plist, always authorization will be requested.
+ (void)requestLocationAuthorization

Declared In

Netmera.h

requestPushNotificationAuthorizationForTypes:

+ (void)requestPushNotificationAuthorizationForTypes:(UIUserNotificationType)types
Discussion

Note: Instead of presenting the permission dialog immediately while app is opening, you should call this method after you explained why your app needs push notifications and what’s the user’s gain after giving permission. This policy can increase your applications’s opt-in rate significantly.

Parameters

types

Notification types which can be used while notifying user via push notifications

Declared In

Netmera.h

sendEvent:

Send an event to Netmera servers.

You can send behavioral actions of your users using this method.

Rather than accepting unstructured information inside events, SDK requires given event to be a valid subclass of @c NetmeraEvent class. This approach provides Netmera to verify type of the given event attributes, which is crucial during event analytics operations on Netmera servers.

+ (void)sendEvent:(__kindof NetmeraEvent *)event

See Also

Declared In

Netmera.h

setAPIKey:

Set given Netmera SDK API key.

Calling this method with a valid API key will effectively start communication with Netmera servers. Netmera will store any operation until it has an API key.

Setting API key to nil or empty string will stop all network operations, and all pending operations will be stored until a valid API key is set again.

+ (void)setAPIKey:(nullable NSString *)APIKey

Parameters

APIKey

Application specific API key gathered from Netmera panel.

Declared In

Netmera.h

setBaseURL:

Changes base API URL to given URL string.

The only use case for this method is when a custom Netmera domain is defined to your application.

+ (void)setBaseURL:(NSString *)URLString

Parameters

URLString

Custom domain string.

Declared In

Netmera.h

setEnabledPopupPresentation:

+ (void)setEnabledPopupPresentation:(BOOL)enabled

setEnabledReceivingPushNotifications:

+ (void)setEnabledReceivingPushNotifications:(BOOL)enabled

setLogLevel:

Set log level for SDK.

Default log level is @c NetmeraLogLevelError.

+ (void)setLogLevel:(NetmeraLogLevel)level

Parameters

level

One of @c NetmeraLogLevel enum values.

Declared In

Netmera.h

setPushDelegate:

Set delegate object to be notified about events related to push notification handling.

+ (void)setPushDelegate:(NSObject<NetmeraPushDelegate> *)delegate

Parameters

delegate

Object which will be notified about events related to push notification handling. This object must conform to @c NetmeraPushDelegate protocol.

Declared In

Netmera.h

start

+ (void)start
Discussion

Warning: In order for Netmera to operate correctly, this method has to be called before -application:didFinishLaunchingWithOptions: method returns.

Declared In

Netmera.h

updateUser:

Set or update the attributes of the user in Netmera.

To send information about your user to Netmera, you should create a @c NetmeraUser object and set the properties of the user object with corresponding values of your user.

After setup, call this method to send data to Netmera servers.

In order to remove a previously set attribute from Netmera, you should set an @c [NSNull null] object to the corresponding attribute on user object.

+ (void)updateUser:(__kindof NetmeraUser *)user

Declared In

Netmera.h

Instance Methods

init

- (instancetype)init