What’s Changed in iOS 2.0 SDK

Please read this post to discover the latest changes and improvements in our SDK.

Here you can find all the changes included in the iOS 2.0 SDK.

SDK Integration Procedure

Starting from 2.0, Netmera’s integration steps have been further simplified. You can utilize a rich set of Netmera features just by drag-n-dropping the SDK to your project, and adding your Api Key to NetmeraSettings.plist. Please check out our Quick Start Guide for details. You will find it really easy to use.

NetmeraSettings.plist file

The first change is on configuring Netmera’s global behaviours. We collected all settings related to Netmera’s global behaviours in one place, via a plist file. There is a new resource file named as “NetmeraSettings.plist”, and you can configure global behavior settings of the framework directly by changing values of related key in the .plist file. Following are the existing keys in the plist file:

  • ApiKey : This takes an NSString value, and you should put your app-specific Api Key – key that you can find in Netmera application’s overview page – here. You can also set your Api Key via [Netmera setApiKey:] method from code. However, if you want to set it from the code, you should call it in application:didFinishLaunchingWithOptions: method of your AppDelegate class.
  • PushInboxEnabled : This is a boolean value which indicates whether Netmera’s push inbox feature should be used or not. Default value is YES. You can also set using [Netmera setPushInboxEnabled:] method.
  • SignificantLocationChangeTrackingEnabled : A boolean value which determines if significant location changes in the device should be tracked by Netmera. This location data is used during targeting your push notifications audience via their locations. Default value is YES. You can also set using [Netmera setSignificantLocationChangeTrackingEnabled:] method.
  • ExceptionReportingEnabled : Netmera can also track your application’s crash and exception scenarios, and show them in Netmera web panel in order to help you find the locate possible bugs in your code. Default value is YES. However, if you use another crash analytics tool, you should set it to NO. You can also set using [Netmera setExceptionReportingEnabled:]method.
  • RichPushShouldBeShownImmediately : This boolean value determines the presentation behavior of Netmera when your app receives a new rich push notification. If this value is YES, coming rich push notifications will be shown to user immediately. If value is NO, Netmera asks for user’s confirmation via an alert view before presenting rich push content to user. Default value is YES. You can also set using [Netmera setRichPushShouldBeShownImmediately:]method.
  • RichPushShouldShowProgressHUD : Boolean value which decides if a loading view should be shown during rich push content is fetched from server. Default is YES. You can also set using [Netmera setRichPushShouldShowProgressHUD:]method.

Class Names

One of the most important changes in version 2.0 is that the class prefix for all classes have been changed from “Netmera” to “NM”. So, you should update your existing codes accordingly.

Additionally, following classes are renamed:

  • NetmeraGeofenceService has been replaced with NMLocationManager
  • NetmeraPushService has been replaced with NMPushManager
  • NetmeraPopupService has been replaced with NMPopupManager
  • NetmeraClient has been replaced with Netmera
  • NetmeraGeoLocation has been replaced with NMGeolocation

Here are the changes about the APIs for particular classes (For details, please refer to docset or resource guides about related methods):

Netmera (previously NetmeraClient) Changes

Methods that are moved from NMLocationManager (previously NetmeraGeofenceService) to here:

+ (BOOL)significantLocationChangeTrackingEnabled;
+ (void)setSignificantLocationChangeTrackingEnabled:(BOOL)enabled;

Methods that are moved from NMPushManager (previously NetmeraPushService) to here:

+ (void)setPushInboxEnabled:(BOOL)enabled;
+ (BOOL)pushInboxEnabled;
+ (void)setRichPushShouldBeShownImmediately:(BOOL)shouldBeShown;
+ (BOOL)richPushShouldBeShownImmediately;

Methods removed:

- (id)initWithApiKey:(NSString*)key;

Methods added:

+ (void)setApiKey:(NSString*)key;
+ (NSString*)apiKey;
+ (void)setExceptionReportingEnabled:(BOOL)enabled;
+ (BOOL)exceptionReportingEnabled;
+ (BOOL)richPushShouldShowProgressHUD;
+ (void)setRichPushShouldShowProgressHUD:(BOOL)shouldShow;

NMPushManager (previously NetmeraPushService) Changes

All synchronous register method are removed. Registering to push notifications is handled always in background thread. Moreover, register methods that are taking device token as a parameter are removed. Also, register methods that are running asynchronously are renamed.

Removed methods:

+ (BOOL)registerWithToken:(NSString *)deviceToken error:(NSError **)error;
+ (void)registerInBackgroundWithToken:(NSString *)deviceToken completionHandler:(void(^(BOOL deviceDidRegister, NSError *error))handler;
+ (BOOL)unregisterWithToken:(NSString *)deviceToken error:(NSError **)error;
+ (void)unregisterInBackgroundWithToken:(NSString *)deviceToken completionHandler:(void(^)(BOOL deviceDidUnregister, NSError *error))handler;
+ (BOOL)handleNotification:(NSDictionary*)userInfo;
+ (NSArray *)getNetmeraDeviceTagsWithError:(NSError **)error;
+ (void)getNetmeraDeviceTagsInBackgroundWithBlock:(void(^)(NSArray *tags, NSError *error))block __deprecated;

Recent register methods are the following:

+ (void)registerWithCompletionHandler:(void(^)(BOOL deviceDidRegister, NSError *error))handler;
+ (void)registerWithDeviceDetail:(NMDeviceDetail *)deviceDetail completionHandler:(void(^)(BOOL deviceDidRegister, NSError *error))handler;
+ (void)unregisterWithCompletionHandler:(void(^)(BOOL deviceDidUnregister, NSError *error))handler;
+ (void)unregisterWithDeviceDetail:(NMDeviceDetail *)deviceDetail completionHandler:(void(^)(BOOL deviceDidUnregister, NSError *error))handler;

Renamed Methods:

+ (void)getDeviceTagsWithCompletionHandler:(void(^)(NSArray *tags, NSError *error))handler;

Added Methods:

+ (BOOL)isRichPushReceived;
+ (void)beginIgnoringRichPushes;
+ (void)endIgnoringRichPushes;
+ (NSString *)deviceToken;
+ (RichPushCompletionHandler)richPushCompletionHandler;
+ (void)setRichPushCompletionHandler:(RichPushCompletionHandler)handler;
+ (void)clearRichPush;
+ (NMProgressHUD *)loadingHUD;
+ (void)setLoadingHUD:(NMProgressHUD *)progressHUD;
+ (BOOL)checkAvailability;

NMPopupManager (previously NetmeraPopupService) Changes

We’ve implemented an observer pattern for popups, so that your classes could be notified when a popup with given key is just triggered. Added Methods:

+ (void)addObserver:(id)object forEventKey:(NSString *)key usingBlock:(NMPopupTriggerResult)resultBlock;
+ (void)removeObserver:(id)object forEventKey:(NSString *)key;

NMLocationManager (previously NetmeraGeofenceService) Changes

Renamed Methods:

+ (void)startLocationTracking;
+ (void)stopLocationTracking;

NMDeviceDetail (previously NetmeraDeviceDetail) Changes

Removed methods and properties:

@property(nonatomic,strong) NSString *token;
@property(nonatomic,strong) NSString *platform;
@property(nonatomic,strong) NSMutableArray *tags;
@property (nonatomic, assign) BOOL shouldOverrideRegisteredTags;
- (id)initWithToken:(NSString *)deviceToken;
+ (NetmeraDeviceDetail *)getDeviceDetailWithToken:(NSString *)token withError:(NSError **)error;
+ (void)getNetmeraDeviceDetailInBackgroundWithToken:(NSString *)token completionHandler:(void(^)(NetmeraDeviceDetail *deviceDetail, NSError *error))handler;
+ (void)getNetmeraDeviceDetailInBackgroundWithToken:(NSString *)token block:(void(^)(NetmeraDeviceDetail *deviceDetail, NSError *error))block;

Added Methods:

- (NSString *)deviceToken;
- (NSArray *)getTags;
- (void)overrideTagsWithNewTags:(NSArray *)tags;
- (void)addTag:(NSString *)tag;
- (void)addTags:(NSArray*)tags;
+ (void)getDeviceDetailWithCompletionHandler:(void(^)(NMDeviceDetail *deviceDetail, NSError *error))handler;

NMPushSenderObject (previously NetmeraPushSenderObject) Changes

Removed methods:

- (NSString *)sendPushNotificationWithError:(NSError **)error;
- (void)sendPushNotificationInBackgroundWithBlock:(void(^)(NSString *notificationId, NSError *error))block;

Renamed Methods:

- (void)sendPushNotificationWithCompletionHandler:(void(^)(NSString *notificationId, NSError *error))handler;

NMPushReport (previously NetmeraPushReport) Changes

Removed methods:

+ (NetmeraPushReport *)getNotificationReportWithId:(NSString *)notificationId error:(NSError **)error;
+ (void)getNotificationReportInBackgroundWithId:(NSString *)notificationId block:(void(^)(NetmeraPushReport *notificationReport, NSError *error))block;

Renamed Methods:

+ (void)getNotificationReportWithId:(NSString *)notificationId completionHandler:(void(^)(NMPushReport *notificationReport, NSError *error))handler;

NMRichPushObject (previously NetmeraRichPushObject) Changes

Added Methods and properties:

@property (nonatomic, strong) NSString *urlString;
@property (nonatomic, assign) BOOL shouldShownInInbox;

NMPushInboxController (previously NetmeraPushInboxController) Changes

Added Methods:

@property (nonatomic, strong) NMRichPushObject *richPush;


0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *