It is crucial for Insider’s iOS SDK to listen to certain AppDelegate methods to run and initialize the SDK before executing any other operation. It is highly recommended that the SDK be initialized right after the didFinishLaunchingWithOptions iOS native method inside the AppDelegate class. Please be informed that delaying the SDK initialization in older SDK versions may cause inconsistencies with some SDK features. Recent SDK versions include improvements to reduce the impact of delayed initialization scenarios.
You can follow these steps to initialize the SDK.
1. Open your AppDelegate.m or AppDelegate.swift file.
2. Import Insider SDK for Objective-C or Swift; Bridging Header configuration is only required if the Swift project contains Objective-C files.
AppDelegate
#import <InsiderMobile/InsiderMobile.h>
import InsiderMobile
3. Call the initWithLaunchOptions method to initialize the Insider One SDK.

AppDelegate
#import <InsiderMobile/InsiderMobile.h>
#import <UserNotifications/UserNotifications.h>
@interface AppDelegate () <UNUserNotificationCenterDelegate>
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
[Insider registerInsiderCallbackWithSelector:@selector(insiderCallback:) sender:self];
[Insider initWithLaunchOptions:launchOptions
partnerName:@"your_partner_name"
appGroup:@"group.com.your-company.your-app"];
[Insider setActiveForegroundPushView];
[Insider registerWithQuietPermission:false];
return YES;
}
@end@main
public final class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
public func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
UNUserNotificationCenter.current().delegate = self
Insider.registerCallback(with: #selector(), sender: self)
Insider.initWithLaunchOptions(
launchOptions,
partnerName: "your_partner_name",
appGroup: "group.com.your-company.your-app"
)
Insider.setActiveForegroundPushView()
Insider.register(withQuietPermission: false)
return true
}
}Late initialization
Calling Insider.initWithLaunchOptions(...) synchronously inside application(_:didFinishLaunchingWithOptions:) is the simplest setup, but it is not required. The init call may happen later, e.g., after asynchronously fetching configuration from your own backend.
UNUserNotificationCenter.current().delegate must be set before Insider.initWithLaunchOptions(...) is called. The Insider SDK init can happen at any time, but the notification center delegate must be in place before it. Otherwise, iOS will deliver the launch push to its default handler before the SDK is wired up, resulting in lost cold-start push attribution.
Insider.initWithLaunchOptions(...) must be invoked on the main queue.
public func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
UNUserNotificationCenter.current().delegate = self
fetchRemoteConfig { partnerName, appGroup in
DispatchQueue.main.async {
Insider.initWithLaunchOptions(
launchOptions,
partnerName: partnerName,
appGroup: appGroup
)
}
}
return true
}
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
[self fetchRemoteConfigWithCompletion:^(NSString *partnerName, NSString *appGroup) {
dispatch_async(dispatch_get_main_queue(), ^{
[Insider initWithLaunchOptions:launchOptions
partnerName:partnerName
appGroup:appGroup];
});
}];
return YES;
}