Migration Guide

IOS SDK 6.2/6.3 to 6.4

Overview

SDK 6.4 adds iOS 12 features support.

To start using the new features replace:

Objective-C:

// Register for notification
ACCNotificationOptions options = (ACCNotificationOptionSound|ACCNotificationOptionBadge|ACCNotificationOptionAlert|ACCNotificationOptionCarPlay);

[[Accengage push] registerForUserNotificationsWithOptions:options];

Swift:

// Register for notification
Accengage.push()?.registerForUserNotifications(options: [.sound, .alert, .badge, .carPlay])

With:

Objective-C:

// Register for notification
ACCNotificationOptions options = (ACCNotificationOptionSound|ACCNotificationOptionBadge|ACCNotificationOptionAlert|ACCNotificationOptionCarPlay|ACCNotificationOptionProvisional|ACCAuthorizationOptionProvidesAppNotificationSettings);

[[Accengage push] registerForUserNotificationsWithOptions:options];

Swift:

// Register for notification
Accengage.push()?.registerForUserNotifications(options: [.notificationOptionSound, .notificationOptionAlert, .notificationOptionBadge, .notificationOptionCarPlay, .notificationOptionProvisional, .authorizationOptionProvidesAppNotificationSettings])

IOS SDK 6.0/6.1 to 6.2

Overview

SDK 6.2 adds GDPR support. Several new methods have been added that provide means of ensuring GDPR compliance. This also means that the SDK integration changed and needs to be updated in your application.

SDK start - new opt-in methods

Replace:

Objective-C:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  
    // Start the SDK with the conf set in the AccengageConfig.plist file
    [Accengage start];
       
    return YES;
}

Swift:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
     
    // Start the SDK with the conf set in the AccengageConfig.plist file
    Accengage.start()
          
    return true
}

with:

Objective-C:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  
    // Start the SDK with the conf set in the AccengageConfig.plist file
    [Accengage startWithOptIn: ACCOptInEnabled];
       
    return YES;
}

Swift:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
     
    // Start the SDK with the conf set in the AccengageConfig.plist file
    Accengage.start(withOptIn: ACCOptIn.enabled)
          
    return true
}

Replace:

Objective-C:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
       
    ACCConfiguration *config = [ACCConfiguration defaultConfig];
    // config.IDFACollectionEnabled = NO;
     
    [Accengage startWithConfig:config];
  
    return YES;
}

Swift:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
     
    let config = ACCConfiguration.defaultConfig()
    // config.isIDFACollectionEnabled = false
     
    Accengage.start(withConfig: config)
          
    return true
}

with:

Objective-C:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
       
    ACCConfiguration *config = [ACCConfiguration defaultConfig];
    // config.IDFACollectionEnabled = NO;
     
    [Accengage startWithConfig:config optIn:ACCOptInEnabled];
  
    return YES;
}

Swift:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
     
    let config = ACCConfiguration.defaultConfig()
    // config.isIDFACollectionEnabled = false
     
    Accengage.start(withConfig: config optIn:ACCOptIn.enabled)
          
    return true
}

Once you have the opt-in information, call the following SDK methods:

Objective-C:

[Accengage setDataOptInEnabled:YES];   
 
// after enabling the data opt-in, you'll need to (re)start Push/Geofence/Beacon services
 
ACCNotificationOptions options = (ACCNotificationOptionSound|ACCNotificationOptionBadge|ACCNotificationOptionAlert|ACCNotificationOptionCarPlay); 
[[Accengage push] registerForUserNotificationsWithOptions:options];
 
// only if you need these services
 
[BMA4SLocationServices setGeofenceServiceEnabled:YES];
[BMA4SLocationServices setBeaconServiceEnabled:YES];

Swift:

Accengage.setDataOptInEnabled(true)
 
// after enabling the data opt-in, you'll need to start Push/Geofence/Beacon services
 
Accengage.push().registerForUserNotifications(options: [.sound, .badge, .alert, .carPlay])
 
// only if you need these services
 
BMA4SLocationServices.setGeofenceServiceEnabled(true);
BMA4SLocationServices.setBeaconServiceEnabled(true);

Objective-C:

[Accengage setGeolocOptInEnabled:YES];   
 
// after enabling the geoloc opt-in, you'll need to (re)start Geofence/Beacon services
 
[BMA4SLocationServices setGeofenceServiceEnabled:YES];
[BMA4SLocationServices setBeaconServiceEnabled:YES];

Swift:

Accengage.setGeolocOptInEnabled(true)
 
// after enabling the geoloc opt-in, you'll need to (re)start Geofence/Beacon services
 
BMA4SLocationServices.setGeofenceServiceEnabled(true);
BMA4SLocationServices.setBeaconServiceEnabled(true);

These methods need to be called at every SDK start meaning that, once you have the opt-in information, you might start the SDK in the following way:

Objective-C:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  
    // Start the SDK with the conf set in the AccengageConfig.plist file
    [Accengage startWithOptIn: ACCOptInEnabled];
    [Accengage setDataOptInEnabled:YES]; 
    // or [Accengage setDataOptInEnabled:NO]; 
    [Accengage setGeolocOptInEnabled:YES];   
    // or [Accengage setGeolocOptInEnabled:NO];  
    return YES;
}

Swift:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
     
    // Start the SDK with the conf set in the AccengageConfig.plist file
    Accengage.start(withOptIn: ACCOptIn.enabled)
    Accengage.setDataOptInEnabled(true)
    // or Accengage.setDataOptInEnabled(false)
    Accengage.setGeolocOptInEnabled(true)
    // or Accengage.setGeolocOptInEnabled(false)
 
    return true
}

Nullability updates

While the SDK doesn't have the opt-in information or if the opt-in is disabled (the user decides to opt-out), its methods will return false, nil or 0. Nullability annotation of the SDK methods has been updated to reflect this. Please make sure that your application handles properly the values returned by the SDK.

Here are some examples (the following list is non exhaustive, please verify if the annotations changed for the methods used by your application):

ACCList:

- (nullable instancetype)initWithId:(NSString *)identifier expirationDate:(nullable NSDate *)date NS_DESIGNATED_INITIALIZER;
Accengage:
+ (nullable ACCPush *)push;
BMA4STracker:
+ (nullable NSString*) A4SID;
+ (nullable NSString *) userID;

IOS SDK 6.0 to 6.1

BMA4SInBox

Retrieve the inbox object

Use obtainMessagesWithCompletionHandler: instead of obtainMessagesForMembers:withHandler:

IOS SDK 5.X to 6.0

Overview

Since the 6.0 the SDK is provided as a dynamic framework and as a result the minimum integration requirements have changed. Also, the integration has been significantly simplified and certain methods are now deprecated.

Requirements

  • Xcode 8 with iOS SDK 10
  • Deployment target: iOS 8 or more recent

From BM4ASConfig.plist to AccengageConfig.plist

A new configuration file have been introduced instead of BM4ASConfig.plist. Replace BM4ASConfig.plist with AccengageConfig.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>appId</key>
    <string>Your App ID</string>
    <key>appPrivateKey</key>
    <string>Your App Private Key</string>
</dict>
</plist>

Import

Objective-C:

#import <Accengage/Accengage.h>

Swift:

@import Accengage

From BMA4STracker To Accengage

The BMA4STracker object is deprecated and replaced by Accengage

Initialization

Objective-C:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
 
    // Start the SDK with the conf set in theAccengageConfig.plist file
    [Accengage start];
     
    // or modify the default config and then call startWithConfig method 
    // ACCConfiguration *config = [ACCConfiguration defaultConfig];
    // config.IDFACollectionEnabled = NO;
    // [Accengage startWithConfig:config];
 
    return YES;
}

Swift:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
    // Start the SDK with the conf set in theAccengageConfig.plist file
    Accengage.start()
         
    // or modify the default config and then call startWithConfig method
    // let config = ACCConfiguration.defaultConfig()
    // config.isIDFACollectionEnabled = false
    // Accengage.start(withConfig: config)
         
    return true
}

Tracking

Several tracking methods are now deprecated.

Track event

Replace:

Objective-C:

[BMA4STracker trackEventWithType:1000 parameters:@[ @"Start" ]];

Swift:

BMA4STracker.trackEvent(withType: 1000, parameters: ["Start"])

With:

Objective-C:

[Accengage trackEvent:1000 withParameters:@[@"Start"]];

Swift:

Accengage.trackEvent(1000, withParameters: ["Start"])
Track lead

Replace:

Objective-C:

[BMA4STracker trackLeadWithLabel:@"lead" value:@"value"];

Swift:

BMA4STracker.trackLead(withLabel: "lead", value: "value")

With:

Objective-C:

[Accengage trackLead:@"lead" value:@"value"];

Swift:

Accengage.trackLead("lead", value: "value")
Track cart

Replace:

Objective-C:

[BMA4STracker trackCartWithId:@"cart_id" forArticleWithId:@"item_id" andLabel:@"item_label" category:@"item_category" price:10. currency:@"EUR" quantity:1];

Swift:

BMA4STracker.trackCart(withId: "cart_id", forArticleWithId: "item_id", andLabel: "item_label", category: "item_category", price: 10, currency: "EUR", quantity: 1)

With:

Objective-C:

ACCCartItem *item = [ACCCartItem itemWithId:@"item_id" name:@"item_label" brand:@"item_brand" category:@"item_category" price:10. quantity:1];
[Accengage trackCart:@"cart_id" currency:@"EUR" item:item];

Swift:

let item = ACCCartItem.init(id: "item_id", name: "item_label", brand: "item_brand", category: "item_category", price: 10, quantity: 1)
Accengage.trackCart("cart_id", currency: "EUR", item: item)
Track purchase

Replace:

Objective-C:

BMA4SPurchasedItem *item = [BMA4SPurchasedItem itemWithId:@"item_id" label:@"item_label" category:@"item_category" price:10. quantity:1];
[BMA4STracker trackPurchaseWithId:@"purchase_id" currency:@"EUR" items:@[item] totalPrice:10.];

Swift:

let item = BMA4SPurchasedItem.init(id: "item_id", label:  "item_label", category: "item_category", price: 10, quantity: 1)
BMA4STracker.trackPurchase(withId: "purchase_id", currency: "EUR", items: [item])

With:

Objective-C:

ACCCartItem *item = [ACCCartItem itemWithId:@"item_id" name:@"item_label" brand:@"item_brand" category:@"item_category" price:10. quantity:1];
[Accengage trackPurchase:@"purchase_id" currency:@"EUR" items:@[item] amount:@(100)];

Swift:

let item = ACCCartItem.init(id: "item_id", name: "item_label", brand: "item_brand", category: "item_category", price: 10, quantity: 1)
Accengage.trackPurchase("purchase_id", currency: "EUR", items: [item], amount: 100)
Track screen display/dismiss

To track a screen display and dismiss, it's no longer necessary to inherit from BMA4SViewController class. You just need to import the Accengage header and and the accengageAlias in the viewDidLoad method:

Objective-C:

// other import 
import <Accengage/Accengage.h>
 
@implementation ViewController
 
- (void)viewDidLoad {
 
    [super viewDidLoad];
    self.accengageAlias = @"controller_id";
 
    // Do any additional setup after loading the view, typically from a nib.
}
 
@end

Swift:

// other import 
import Accengage
 
 
class ViewController: UIViewController {
    override func viewDidLoad() {
        
        super.viewDidLoad()
        self.accengageAlias = "controller_id"
 
        // Do any additional setup after loading the view, typically from a nib.
    }
}

If you prefer to keep tracking screens manually, you'll need to call the trackDisplay/trackDismiss method in viewDidAppear/viewDidDisappear method instead of broadcasting notifications.

Replace:

Objective-C:

@interface ViewController ()
 
@property (nonatomic, retain) NSString* A4SViewControllerAlias;
 
@end
 
@implementation ViewController
 
- (void)viewDidLoad {
 
    [super viewDidLoad];
    self.A4SViewControllerAlias = @"controller_id";
 
    // Do any additional setup after loading the view, typically from a nib.
}
 
#define A4S_INAPP_NOTIF_VIEW_DID_APPEAR @"A4S_INAPP_NOTIF_VIEW_DID_APPEAR"
#define A4S_INAPP_NOTIF_VIEW_DID_DISAPPEAR @"A4S_INAPP_NOTIF_VIEW_DID_DISAPPEAR"
 
- (void)viewDidAppear:(BOOL)animated {
 
    [super viewDidAppear:animated];
 
    // notify the InAppNotification SDK that this the active view controller
    [[NSNotificationCenter defaultCenter] postNotificationName:A4S_INAPP_NOTIF_VIEW_DID_APPEAR object:self];
}
 
- (void)viewDidDisappear:(BOOL)animated {
 
    [super viewDidDisappear:animated];
 
    // notify the InAppNotification SDK that this view controller in no more active
    [[NSNotificationCenter defaultCenter] postNotificationName:A4S_INAPP_NOTIF_VIEW_DID_DISAPPEAR object:self];
}
 
@end

Swift:

class ViewController: UIViewController {
 
    public var A4SViewControllerAlias: String = ""
 
    override func viewDidLoad() {
 
        super.viewDidLoad()
        self.A4SViewControllerAlias = "controller_id"
    }
 
    override func viewDidAppear(_ animated: Bool) {
 
        super.viewDidAppear(animated)
        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "A4S_INAPP_NOTIF_VIEW_DID_APPEAR"), object: self)
    }
 
    override func viewDidDisappear(_ animated: Bool) {
 
        super.viewDidDisappear(animated)
        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "A4S_INAPP_NOTIF_VIEW_DID_DISAPPEAR"), object: self)
    }
}

With:

Objective-C:

#import <Accengage/Accengage.h>
 
@interface ViewController ()
 
@end
 
 
@implementation ViewController
 
- (void)viewDidLoad {
 
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}
 
- (void)viewDidAppear:(BOOL)animated {
 
    [super viewDidAppear:animated];
    [Accengage trackScreenDisplay:@"controller_id"];
}
 
- (void)viewDidDisappear:(BOOL)animated {
 
 
    [super viewDidDisappear:animated];
    [Accengage trackScreenDismiss:@"controller_id"];
}
 
@end

Swift:

import Accengage
 
class ViewController: UIViewController {
 
    override func viewDidLoad() {
        super.viewDidLoad()
    }
 
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        Accengage.trackScreenDisplay("controller_id")
    }
 
    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)
        Accengage.trackScreenDismiss("controller_id")
    }
}

Update device information

Replace:

Objective-C:

[BMA4STracker updateDeviceInfo:@{@"key":@"value"}];

Swift:

BMA4STracker.updateDeviceInfo(["key":"value"])

With:

Objective-C:

[Accengage updateDeviceInfo:@{@"key":@"value"}];

Swift:

Accengage.updateDeviceInfo(["key":"value"])

Static lists

BMA4SList > ACCList

Replace:

Objective-C:

BMA4SList* list = [BMA4SList listWithId:@"" expirationDate:nil];
list.listId = @"list_id";

Swift:

let list = BMA4SList(id: "", expirationDate: nil)
list.listId = "list_id"

With:

Objective-C:

ACCList *list = [ACCList listWithId:@"" expirationDate:nil];
list.identifier = @"list_id";

Swift:

let list = ACCList(id: "", expirationDate: nil)
list.identifier = "list_id"
Subscribe

Replace:

Objective-C:

BMA4SList* list = [BMA4SList listWithId:@"list_id"];
[BMA4STracker subscribeToLists:@[list]];

Swift:

let list = BMA4SList(id: "")
BMA4STracker.subscribe(toLists: [list])

With:

Objective-C:

ACCList *list = [ACCList listWithId:@""];
[Accengage subscribeToLists:@[list]];

Swift:

let list = ACCList(id: "")
Accengage.subscribe(to: [list])
Unsubscribe

Replace:

Objective-C:

BMA4SList* list = [BMA4SList listWithId:@"list_id"];
[BMA4STracker unsubscribeFromLists:@[list]];

Swift:

let list = BMA4SList(id: "")
BMA4STracker.unsubscribe(fromLists: [list])

With:

Objective-C:

ACCList *list = [ACCList listWithId:@""];
[Accengage unsubscribeFromLists:@[list]];

Swift:

let list = ACCList(id: "")
Accengage.unsubscribe(from: [list])
Subscription status

Replace:

Objective-C:

BMA4SList* list = [BMA4SList listWithId:@"list_id"];
[BMA4STracker getSubscriptionStatusForLists:@[list] completionHandler:^(id  _Nullable result, NSError * _Nullable error) {
    // Do something ...
}];

Swift:

let list = BMA4SList(id: "")
BMA4STracker.getSubscriptionStatus(forLists: [list]) { (result, error) in
    // Do something ...
}

With:

Objective-C:

ACCList *list = [ACCList listWithId:@""];
[Accengage subscriptionStatusForLists:@[list_] completionHandler:^(NSArray<ACCList *> * _Nullable result, NSError * _Nullable error) {
    // Do something ...
}];

Swift:

let list = ACCList(id: "")
Accengage.subscriptionStatus(for: [list]) { (result, error) in
    // Do something ...
}
Current subscriptions

Replace:

Objective-C:

[BMA4STracker getListOfSubscriptions:^(id  _Nullable result, NSError * _Nullable error) {
    // Do something ...
}];

Swift:

let list = BMA4SList(id: "")
BMA4STracker.getListOfSubscriptions { (result, error) in
    // Do something ...
}

With:

Objective-C:

[Accengage listOfSubscriptions:^(NSArray<ACCList *> * _Nullable result, NSError * _Nullable error) {
    // Do something ...
}];

Swift:

let list = ACCList(id: "")
Accengage.list { (result, error) in
    // Do something ...
}

Accengage Identifier

Replace:

Objective-C:

[BMA4STracker A4SID];

Swift:

BMA4STracker.a4SID()

With:

Objective-C:

[Accengage shared].accengageId

Swift:

Accengage.shared()?.accengageId

Suspend all services

Replace:

Objective-C:

[BMA4STracker setDoNotTrack:YES];

Swift:

BMA4STracker.setDoNotTrack(true)

With:

Objective-C:

[Accengage suspendAllServices:YES]

Swift:

Accengage.suspendAllServices(true)

Disable network calls

Replace:

Objective-C:

[BMA4STracker setRestrictedConnection:YES];
 
// Check
[Accengage isRestrictedConnection];

Swift:

BMA4STracker.setRestrictedConnection(true)
 
// Check
Accengage.isRestrictedConnection();

With:

Objective-C:

[Accengage setNetworkCallsDisabled:YES]
 
// Check
[Accengage areNetworkCallsDisabled];

Swift:

Accengage.setNetworkCallsDisabled(true)
 
// Check
Accengage.areNetworkCallsDisabled()

Enable logs

Replace:

Objective-C:

[BMA4STracker setDebugMode:YES];

Swift:

BMA4STracker.setDebugMode(true)

With:

Objective-C:

[Accengage setLoggingEnabled:YES]

Swift:

Accengage.setLoggingEnabled(true)

From BMA4SNotification to ACCPush

The BMA4SNotification object is deprecated and replaced by ACCPush

Shared instance

Replace:

Objective-C:

[BMA4SNotification sharedBMA4S];

Swift:

BMA4SNotification.sharedBMA4S()

With:

Objective-C:

[Accengage push];

Swift:

Accengage.push()

Register for user notifications

In order to register for push notifications, you can now call the registerForUserNotificationsWithOptions method. This means that you're no longer required to maintain the registration code in your application, just call this method and the SDK will register the app for you. If you want to use custom categories for interactive notifications, you should call the setCustomCategories method first.

Replace:

Objective-C:

NSMutableSet *categories = [NSMutableSet setWithSet:[[BMA4SNotification sharedBMA4S] notificationCategories]];
NSSet *customCategories = [NSSet set]; // App custom categories
  
[categories unionSet:customCategories];
  
if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 0, 0}]) {
     
UNUserNotificationCenter *notificationCenter = [UNUserNotificationCenter currentNotificationCenter];
    [notificationCenter setNotificationCategories:categories];
  
    UNAuthorizationOptions options = (UNAuthorizationOptionAlert | UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionCarPlay);
  
    [notificationCenter requestAuthorizationWithOptions:options completionHandler:^(BOOL granted, NSError * _Nullable error) {
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    }];
}
else {
    NSUInteger options = (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound);
  
    UIApplication *application = [UIApplication sharedApplication];
    [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:options categories:categories]];
    [application registerForRemoteNotifications];
}

Swift:

let categories =  BMA4SNotification.sharedBMA4S().notificationCategories().union(customCategories)
         
if #available(iOS 10, *) {
 
    let center = UNUserNotificationCenter.current()
    center.setNotificationCategories(categories as! Set<UNNotificationCategory>)
    center.requestAuthorization(options:[.alert, .badge, .sound, .carPlay]) { (granted, error) in
        UIApplication.shared.registerForRemoteNotifications()
    }
}
else {
    let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: categories  as? Set<UIUserNotificationCategory>)
    let application = UIApplication.shared
    application.registerUserNotificationSettings(settings)
    application.registerForRemoteNotifications()
}

With:

Objective-C:

// The app custom categories set 
[[Accengage push] setCustomCategories:customCategories];
 
// Register for notification
ACCNotificationOptions options = (ACCNotificationOptionSound | ACCNotificationOptionBadge | ACCNotificationOptionAlert | ACCNotificationOptionCarPlay);
[[Accengage push] registerForUserNotificationsWithOptions:options];

Swift:

// The app custom categories set 
Accengage.push().customCategories = customCategories
 
 
// Register for notification
Accengage.push().registerForUserNotifications(options: [.sound, .badge, .alert, .carPlay])

Notification callbacks

Remove the following methods from application:didFinishLaunchingWithOptions: method of your appDelegate :

Objective-C:

[[BMA4SNotification sharedBMA4S] didFinishLaunchingWithOptions:launchOptions];

Swift:

BMA4SNotification.sharedBMA4S().didFinishLaunchingWithOptions(launchOptions)

You're no longer required to implement the notification callbacks. The Accengage SDK is now able to intercept app delegate messages and forwarding them to your original app delegate.

This should be compatible with the majority of applications use cases, but if you prefer to disable this behavior, you can set automaticPushDelegateEnabled to NO in either your AccengageConfig.plist file or on a ACCConfig object passed to [Accengage startWithConfig:].

Objective-C:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     
    ACCConfiguration *config = [ACCConfiguration defaultConfig];
    config.automaticPushDelegateEnabled = NO;
    [Accengage startWithConfig:config];
 
    return YES;
}

Swift:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
            
    let config = ACCConfiguration.defaultConfig()
    config.automaticPushDelegateEnabled = false
    Accengage.start(withConfig: config)
         
    return true
}

If you choose to disable automatic integration, you will need to replace :

Objective-C:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(nonnull NSData *)deviceToken {
    [[BMA4SNotification sharedBMA4S] registerDeviceToken:deviceToken];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler {
    [[BMA4SNotification sharedBMA4S] didReceiveRemoteNotification:userInfo];
    completionHandler(UIBackgroundFetchResultNoData);
}
 
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(nonnull NSDictionary *)userInfo completionHandler:(nonnull void (^)())completionHandler {
    [[BMA4SNotification sharedBMA4S] handleActionWithIdentifier:identifier forRemoteNotification:userInfo];
    completionHandler();
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(nonnull NSDictionary *)userInfo withResponseInfo:(nonnull NSDictionary *)responseInfo completionHandler:(nonnull void (^)())completionHandler {
    [[BMA4SNotification sharedBMA4S] handleActionWithIdentifier:identifier forRemoteNotification:userInfo];
    completionHandler();
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(nonnull UILocalNotification *)notification {
    [[BMA4SNotification sharedBMA4S] didReceiveLocalNotification:notification];
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(nonnull UILocalNotification *)notification completionHandler:(nonnull void (^)())completionHandler {
    [[BMA4SNotification sharedBMA4S] handleActionWithIdentifier:identifier forLocalNotification:notification];
    completionHandler();
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(nonnull UILocalNotification *)notification withResponseInfo:(nonnull NSDictionary *)responseInfo completionHandler:(nonnull void (^)())completionHandler {
    [[BMA4SNotification sharedBMA4S] handleActionWithIdentifier:identifier forLocalNotification:notification];
    completionHandler();
}

Swift:

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    BMA4SNotification.sharedBMA4S().registerDeviceToken(deviceToken)
}
     
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    BMA4SNotification.sharedBMA4S().didReceiveRemoteNotification(userInfo)
    completionHandler(.noData)
}
     
func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [AnyHashable : Any], completionHandler: @escaping () -> Void) {
    BMA4SNotification.sharedBMA4S().handleAction(withIdentifier: identifier, forRemoteNotification: userInfo)
    completionHandler()
}
     
func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [AnyHashable : Any], withResponseInfo responseInfo: [AnyHashable : Any], completionHandler: @escaping () -> Void) {
    BMA4SNotification.sharedBMA4S().handleAction(withIdentifier: identifier, forRemoteNotification: userInfo)
    completionHandler()
}
     
func application(_ application: UIApplication, didReceive notification: UILocalNotification) {
    BMA4SNotification.sharedBMA4S().didReceive(notification)
}
     
func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, for notification: UILocalNotification, completionHandler: @escaping () -> Void) {
    BMA4SNotification.sharedBMA4S().handleAction(withIdentifier: identifier, for: notification)
    completionHandler();
}
     
func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, for notification: UILocalNotification, withResponseInfo responseInfo: [AnyHashable : Any], completionHandler: @escaping () -> Void) {
    BMA4SNotification.sharedBMA4S().handleAction(withIdentifier: identifier, for: notification)
    completionHandler();
}

With:

Objective-C:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(nonnull NSData *)deviceToken {
    [[Accengage push] didRegisterForUserNotificationsWithDeviceToken:deviceToken];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler {
    [[Accengage push] didReceiveRemoteNotification:userInfo];
    completionHandler(UIBackgroundFetchResultNoData);
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(nonnull NSDictionary *)userInfo completionHandler:(nonnull void (^)())completionHandler {
    [[Accengage push] handleActionWithIdentifier:identifier forRemoteNotification:userInfo];
    completionHandler();
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(nonnull NSDictionary *)userInfo withResponseInfo:(nonnull NSDictionary *)responseInfo completionHandler:(nonnull void (^)())completionHandler {
    [[Accengage push] handleActionWithIdentifier:identifier forRemoteNotification:userInfo withResponseInfo:responseInfo];
    completionHandler();
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(nonnull UILocalNotification *)notification {
    [[Accengage push] didReceiveLocalNotification:notification];
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(nonnull UILocalNotification *)notification completionHandler:(nonnull void (^)())completionHandler {
    [[Accengage push] handleActionWithIdentifier:identifier forLocalNotification:notification];
    completionHandler();
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(nonnull UILocalNotification *)notification withResponseInfo:(nonnull NSDictionary *)responseInfo completionHandler:(nonnull void (^)())completionHandler {
    [[Accengage push] handleActionWithIdentifier:identifier forLocalNotification:notification withResponseInfo:responseInfo];
    completionHandler();
}

Swift:

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    Accengage.push().didRegisterForUserNotifications(withDeviceToken: deviceToken)
}
     
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    Accengage.push().didReceiveRemoteNotification(userInfo)
    completionHandler(.noData)
}
     
func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [AnyHashable : Any], completionHandler: @escaping () -> Void) {
    Accengage.push().handleAction(withIdentifier: identifier!, forRemoteNotification: userInfo)
    completionHandler()
}
     
func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [AnyHashable : Any], withResponseInfo responseInfo: [AnyHashable : Any], completionHandler: @escaping () -> Void) {
    Accengage.push().handleAction(withIdentifier: identifier!, forRemoteNotification: userInfo)
    completionHandler()
}
     
func application(_ application: UIApplication, didReceive notification: UILocalNotification) {
    Accengage.push().didReceive(notification)
}
     
func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, for notification: UILocalNotification, completionHandler: @escaping () -> Void) {
    Accengage.push().handleAction(withIdentifier: identifier, for: notification)
    completionHandler();
}
     
func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, for notification: UILocalNotification, withResponseInfo responseInfo: [AnyHashable : Any], completionHandler: @escaping () -> Void) {
    Accengage.push().handleAction(withIdentifier: identifier, for: notification)
    completionHandler();
}

Accengage push delegate

Use ACCPushDelegate instead of BMA4SNotificationDelegate

Handle incoming URL schemes

You're no longer required to call Accenage open url method. The Accengage SDK is now able to intercept app delegate messages and forwarding them to your original app delegate like for the notifications callbacks. All what you need to do is to add the following methods to your application delegate

Objective-C:

- (BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(nonnull id)annotation {
 
    // Do something ...
    return YES;
}
 
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    // Do something ...
    return YES;
}

Swift:

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
 
    // Do something ...
    return true
}
     
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
 
 
    // Do something ...
    return true
}

But if you set automaticPushDelegateEnabled to NO you will need to replace :

Objective-C:

- (BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(nonnull id)annotation {
 
 
    [[BMA4SNotification sharedBMA4S] applicationHandleOpenUrl:url];
 
    // Do something ...
    return YES;
}
 
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
   
    [[BMA4SNotification sharedBMA4S] applicationHandleOpenUrl:url];
     
    // Do something ...
    return YES;
}

Swift:

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
 
 
    BMA4SNotification.sharedBMA4S().applicationHandleOpen(url)
    // Do something ...
    return true
}
     
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
 
    BMA4SNotification.sharedBMA4S().applicationHandleOpen(url)
 
    // Do something ...
    return true
}

With:

Objective-C:

- (BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(nonnull id)annotation {
    
    [Accengage handleOpenURL:url];
 
    // Do something ...
    return YES;
}
 
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    
    [Accengage handleOpenURL:url];
 
    // Do something ...
    return YES;
}

Swift:

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
 
 
    Accengage.handleOpen(url)
    // Do something ...
    return true
}
     
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
 
    Accengage.handleOpen(url)
 
    // Do something ...
    return true
}