Migration guide from 2.x to 3.x

MOCA.h API changes

Changed methods:

  • [MOCA version];

Has changed to:

MOCA.sdKVersion;


  • +(void) trackViewed:(NSString*) itemId belongingTo:(NSString*)category withReco:(BOOL)recommended;

Has changed to:

  • + (void)trackViewed:(NSString *)itemId belongingTo:(NSString *)category wasRecommended:(BOOL)recommended;

The following accessors are now properties instead of method calls.

appKey
appSecret
config

(e.g (Objective-C) Use MOCA.appKey instead of [MOCA appKey])


The following methods have been removed:

+(CLLocation*) getLastKnownLocation;

//UILocalNotification no longer supported

+(void)handleLocalNotification:(UILocalNotification *)notification;

+(BOOL)isMocaLocalNotification:(UILocalNotification *)notification;

+(BOOL)handleActionWithIdentifier:(NSString *)identifier
             forLocalNotification:(UILocalNotification *)notification;


Event and action listener changes

The MOCAProximityEventsDelegate protocol has been removed.

Use the following methods instead. Location Events Listener

/**
 * Adds a new observer for Region Events (RegionGroups, Places, Zones, Beacons)
 * Compatible protocols
 *  RegionEventsObserver
 *  RegionGroupEventsObserver
 *  PlaceEventsObserver
 *  ZoneEventsObserver
 *  BeaconEventsObserver.
 * Read the protocols specification in the MOCARegion.h header
 * @param regionObserver region observer
 */
+ (void)addRegionObserver:(id <RegionEventsObserver>)regionObserver;

/**
 * Removes a region observer.
 * @param regionObserver class to be removed.
 */
+ (void)removeRegionObserver:(id <RegionEventsObserver>)regionObserver;

The MOCAProximityActionsDelegate has been removed. In order to handle custom actions, register the handler as follows:

MOCA.customActionHandler = self;

Where self implements the MOCACustomActionHandler protocol.