If you have multiple apps, initialize the SDK with your app identifier so that the app's sessions, user data, and push notification targeting are attributed to the correct app. This method works the same way as the existing Initialize SDK method, with one additional appIdentifier parameter.
This method is available on iOS SDK 16.2.0 or higher.
App identifier format
Your app identifier is provided by Insider One. It must follow these rules:
Only lowercase letters (a-z), digits (0-9), and underscores (_).
Must start with a lowercase letter or a digit.
At most 50 characters. Pattern: ^[a-z0-9][a-z0-9_]{0,49}$
Bundle-identifier style values such as com.acme.myapp are not valid.
An invalid app identifier does not block initialization. The SDK logs a warning, ignores the value, and initializes as if no app identifier was passed. In that case, the app's data is attributed to the partner's default app.
The following table shows the data type for the method's parameters.
Parameter | Data Type | Description |
|---|---|---|
launchOptions | NSDictionary (nullable) | The launchOptions dictionary provided by the didFinishLaunchingWithOptions method. |
partnerName | NSString | Your partner name provided by Insider One. |
appGroup | NSString | Your App Group, e.g. group.com.your-company.your-app. |
appIdentifier | NSString | Your app identifier provided by Insider One. Must match ^[a-z0-9][a-z0-9_]{0,49}$. |
Method signatures
+ (void)initWithLaunchOptions:(nullable NSDictionary *)launchOptions
partnerName:(nonnull NSString *)partnerName
appGroup:(nonnull NSString *)appGroup
appIdentifier:(nonnull NSString *)appIdentifier;class func initWithLaunchOptions(_ launchOptions: [AnyHashable : Any]?,
partnerName: String,
appGroup: String,
appIdentifier: String)Method examples
Call the method inside didFinishLaunchingWithOptions in your AppDelegate, as you do for the standard initialization.
#import <InsiderMobile/InsiderMobile.h>
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Insider registerInsiderCallbackWithSelector:@selector(insiderCallback:) sender:self];
[Insider initWithLaunchOptions:launchOptions
partnerName:@"your_partner_name"
appGroup:@"group.com.your-company.your-app"
appIdentifier:@"your_app_identifier"];
return YES;
}import InsiderMobile
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Insider.registerCallback(with: #selector(insiderCallback(_:)), sender: self)
Insider.initWithLaunchOptions(launchOptions,
partnerName: "your_partner_name",
appGroup: "group.com.your-company.your-app",
appIdentifier: "your_app_identifier")
return true
}Initialization behavior
Pass the app identifier on every app launch. The app identifier is kept for the running session; call the method with the same value each time the app starts.
If the app identifier is invalid, the SDK logs a warning, ignores the value, and initialization still completes.
The app identifier is fixed at initialization. A different value passed in a later init call during the same session is ignored and logged.
The existing initWithLaunchOptions:partnerName:appGroup: method is unchanged and remains fully supported.
Calling reinit with a different partner name clears the app identifier. Calling it with the same partner name keeps it.