iOS SDK - Configuration Methods Reference

iOS SDK - Configuration Reference

This document provides a comprehensive reference for all configuration options available in the Singular SDK for iOS applications. The SingularConfig object allows you to customize the SDK's behavior, including tracking settings, attribution options, privacy controls, and more. Each configuration property is presented with a description, signature, and practical usage examples.

appGroupName

SingularConfig.appGroupName Property

Sets the app group name for sharing data between the main app and app extensions. This is required when using app extensions with the SDK.

Signature

@property (strong) NSString *appGroupName;

Usage Example

Swift Objective-C
// Set app group name for app extensions
config.appGroupName = "group.com.yourcompany.yourapp"

brandedDomains

SingularConfig.brandedDomains Property

Sets branded domains for web-to-app attribution. This allows you to specify custom domains that should be tracked for attribution purposes.

Setting this property replaces any previously set branded domains. Pass the complete list in a single assignment rather than appending.

Signature

@property (strong) NSArray *brandedDomains;

Usage Example

Swift Objective-C
// Set branded domains for web-to-app attribution
config.brandedDomains = ["yourcompany.com", "go.yourcompany.com"]

clipboardAttribution

Enterprise Feature: Clipboard-Based DDL requires the Singular WebSDK which is an enterprise feature. Contact your Customer Success Manager to enable this feature for your account.

SingularConfig.clipboardAttribution Property

Enables clipboard attribution for the SDK. When enabled, the SDK will check the device clipboard for attribution links during initialization. Default value is NO .

Signature

@property (assign) BOOL clipboardAttribution;

Usage Example

Swift Objective-C
// Enable clipboard attribution
config.clipboardAttribution = true

conversionValueUpdatedCallback

SingularConfig.conversionValueUpdatedCallback Property

Sets a callback function to be called when the SKAdNetwork conversion value is updated. This allows you to react to conversion value changes.

Signature

@property (copy) void(^conversionValueUpdatedCallback)(NSInteger);

Usage Example

Swift Objective-C
// Set conversion value updated callback
config.conversionValueUpdatedCallback = { conversionValue in
    print("Conversion value updated to: \(conversionValue)")
    // Update UI or take other actions based on the new conversion value
}

conversionValuesUpdatedCallback

SingularConfig.conversionValuesUpdatedCallback Property

Sets a callback function to be called when the SKAdNetwork 4.0 conversion values are updated. This is specific to iOS 16.1+ and allows you to react to changes in fine, coarse, and lock values.

Signature

@property (copy) void(^conversionValuesUpdatedCallback)(NSNumber *, NSNumber *, BOOL);

Usage Example

Swift Objective-C
// Set conversion values updated callback for SKAdNetwork 4.0
config.conversionValuesUpdatedCallback = { fineValue, coarseValue, lock in
    print("Conversion values updated - Fine: \(fineValue ?? 0), Coarse: \(coarseValue ?? 0), Lock: \(lock)")
    // Update UI or take other actions based on the new conversion values
}

customSdid

SingularConfig.customSdid Property

Enterprise Feature: Sets a custom SDID (Singular Device ID). This allows you to provide your own device identifier instead of using the one generated by Singular.

Signature

@property (strong) NSString *customSdid;

Usage Example

Swift Objective-C
// Set custom SDID
config.customSdid = "custom-device-id-12345"

deviceAttributionCallback

SingularConfig.deviceAttributionCallback Property

BETA Feature: Sets a callback function to be invoked when device attribution data is available from the /start response. The callback is dispatched on a background queue, so dispatch any UI work to the main thread.

Key Type Notes
network NSString Attribution source. "organic" for non-attributed installs.
campaign_id NSString Present only when attributed.
campaign_name NSString Present only when attributed.
click_timestamp NSNumber (epoch microseconds) Present only when attributed. Divide by 1,000,000 for seconds.

The callback is only invoked when the /start response contains an attribution_info object. For organic installs, only network is populated.

Signature

@property (copy) void(^deviceAttributionCallback)(NSDictionary *);

Usage Example

Swift Objective-C
// Set device attribution callback
config.deviceAttributionCallback = { attributionData in
    guard let attributionData = attributionData else { return }
    print("Attribution data received: \(attributionData)")

    let network = attributionData["network"] as? String
    let campaignId = attributionData["campaign_id"] as? String
    let campaignName = attributionData["campaign_name"] as? String
    let clickTimestamp = attributionData["click_timestamp"] as? NSNumber

    // UI work must be dispatched to the main thread
    DispatchQueue.main.async {
        if let campaignName = campaignName {
            self.showCampaignSpecificContent(campaignName)
        }
    }
}

didSetSdidHandler

SingularConfig.didSetSdidHandler Property

Enterprise Feature: Sets a callback function to be called when the SDID (Singular Device ID) is set after you assign one via customSdid. The result argument is the SDID string that was just stored.

Typically used together with sdidReceivedHandler. Set both when managing a custom SDID so you are notified both when the SDK accepts a new SDID and when the SDK surfaces an existing one.

Signature

typedef void (^SdidAccessorHandler)(NSString *result);
@property (copy) SdidAccessorHandler didSetSdidHandler;

Usage Example

Swift Objective-C
// Set callback for when SDID is set
config.customSdid = "custom-device-id-12345"
config.didSetSdidHandler = { sdid in
    print("SDID was set: \(sdid)")
    // Perform any actions needed after SDID is set
}

enableLogging

SingularConfig.enableLogging Property

Enables SDK logging. Useful for debugging and troubleshooting during development. It's recommended to disable logging in production builds. Default value is NO .

Logging is silent until both enableLogging is set to YES and logLevel is set to a value above SingularLogLevelNone .

Signature

@property (assign) BOOL enableLogging;

Usage Example

Swift Objective-C
// Enable logging for debug builds
config.enableLogging = true
config.logLevel = .debug

enableOdmWithTimeoutInterval

SingularConfig.enableOdmWithTimeoutInterval Property

Sets the timeout interval in seconds for Google ODM (On-Device Measurement) retrieval. ODM is Google's mobile ads measurement system that surfaces install attribution data on-device. Default value is 0 (ODM retrieval disabled).

Signature

@property (assign) NSInteger enableOdmWithTimeoutInterval;

Usage Example

Swift Objective-C
// Enable Google ODM with 5 second timeout
config.enableOdmWithTimeoutInterval = 5

espDomains

SingularConfig.espDomains Property

Sets the ESP (Email Service Provider) domains for email attribution. This allows you to specify which email domains should be considered for attribution.

Signature

@property (strong) NSArray *espDomains;

Usage Example

Swift Objective-C
// Set ESP domains for email attribution
config.espDomains = ["mailchimp.com", "sendgrid.net", "campaign-monitor.com"]

globalProperties

SingularConfig.globalProperties Property

Provides read-only access to the global properties dictionary. This contains all global properties that have been set for the configuration.

Signature

@property (readonly) NSMutableDictionary *globalProperties;

Usage Example

Swift Objective-C
// Access global properties
print("Global properties: \(config.globalProperties)")

initWithApiKey

SingularConfig Initialization

Initializes a new SingularConfig object with your API key and secret. This is the first step in configuring the Singular SDK.

Signature

- (id)initWithApiKey:(NSString *)apikey andSecret:(NSString *)secret;

Usage Example

Swift Objective-C
// Create configuration object
let config = SingularConfig(apiKey: "SDK KEY", andSecret: "YOUR_SECRET")

launchOptions

SingularConfig.launchOptions Property

Sets the launch options dictionary from the app delegate. This is used to process deep links and other launch data.

Signature

@property (strong) NSDictionary *launchOptions;

Usage Example

Swift Objective-C
// Set launch options from app delegate
func application(_ application: UIApplication, 
                 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    let config = SingularConfig(apiKey: "API_KEY", andSecret: "SECRET")
    config.launchOptions = launchOptions
    Singular.start(config)
    return true
}

limitAdvertisingIdentifiers

SingularConfig.limitAdvertisingIdentifiers Property

Enables or disables the use of advertising identifiers. This option affects how the SDK collects and uses device identifiers for tracking and attribution. Default value is NO .

This property is compiled out of the Singular Kids SDK build (guarded by #ifndef SINGULAR_KIDS). If you are integrating Singular-Kids-SDK, this property is unavailable — the Kids SDK enforces stricter identifier handling automatically.

Signature

@property (assign) BOOL limitAdvertisingIdentifiers;

Usage Example

Swift Objective-C
// Enable limited identifiers mode
config.limitAdvertisingIdentifiers = true

logLevel

SingularConfig.logLevel Property

Sets the verbosity of SDK logging. Logging must also be enabled via enableLogging for any output to be emitted. Default value is SingularLogLevelNone (no logging).

Available levels (from SingularLogLevel.h):

  • SingularLogLevelNone (0) — No logging
  • SingularLogLevelError (1) — Errors only
  • SingularLogLevelWarning (2) — Errors and warnings
  • SingularLogLevelInfo (3) — Errors, warnings, and info
  • SingularLogLevelDebug (4) — All logs including debug
  • SingularLogLevelVerbose (5) — Most verbose

Signature

@property (assign) SingularLogLevel logLevel;

Usage Example

Swift Objective-C
// Set verbose logging for detailed debugging
config.enableLogging = true
config.logLevel = .verbose

manualSkanConversionManagement

SingularConfig.manualSkanConversionManagement Property

Enables manual management of SKAdNetwork conversion values. When enabled, the SDK will not automatically update conversion values, allowing you to control them manually.

Signature

@property (assign) BOOL manualSkanConversionManagement;

Usage Example

Swift Objective-C
// Enable manual SKAdNetwork conversion management
config.manualSkanConversionManagement = true

openUrl

SingularConfig.openUrl Property

Sets the URL used to open the app. This is used for custom URL scheme deep links.

Signature

@property (strong) NSURL *openUrl;

Usage Example

Swift Objective-C
// Set open URL for custom URL schemes
func application(_ app: UIApplication, 
                 open url: URL, 
                 options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    let config = SingularConfig(apiKey: "API_KEY", andSecret: "SECRET")
    config.openUrl = url
    Singular.start(config)
    return true
}

pushNotificationLinkPath

SingularConfig.pushNotificationLinkPath Property

Sets the paths to look for deep links in push notification payloads. This helps the SDK find and process attribution links in push notifications.

Signature

@property (strong) NSArray<NSArray<NSString*>*> *pushNotificationLinkPath;

Usage Example

Swift Objective-C
// Set push notification link paths
config.pushNotificationLinkPath = [
    ["data", "deeplink"],
    ["notification", "data", "url"],
    ["custom", "link"]
]

pushNotificationPayload

SingularConfig.pushNotificationPayload Property

Sets the push notification payload for attribution. This allows the SDK to process push notification data during initialization.

Signature

@property (strong) NSDictionary *pushNotificationPayload;

Usage Example

Swift Objective-C
// Set push notification payload
config.pushNotificationPayload = userInfo

sdidReceivedHandler

SingularConfig.sdidReceivedHandler Property

Enterprise Feature: Sets a callback function to be called when the SDID (Singular Device ID) becomes available — including SDIDs that were previously stored. The result argument is the SDID string.

Typically used together with didSetSdidHandler. Set both when managing a custom SDID so you are notified both when the SDK accepts a new SDID and when the SDK surfaces an existing one.

Signature

typedef void (^SdidAccessorHandler)(NSString *result);
@property (copy) SdidAccessorHandler sdidReceivedHandler;

Usage Example

Swift Objective-C
// Set callback for when SDID is received
config.sdidReceivedHandler = { sdid in
    print("SDID received: \(sdid)")
    // Store or use the SDID as needed
    self.storeDeviceIdentifier(sdid)
}

setGlobalProperty

SingularConfig.setGlobalProperty Method

Sets a global property during SDK initialization. This property will be sent with all events tracked by the SDK. This is a method rather than a property, allowing for chained configuration.

Signature

- (void)setGlobalProperty:(NSString *)key 
                withValue:(NSString *)value 
         overrideExisting:(BOOL)overrideExisiting;

Usage Example

Swift Objective-C
// Add global properties
config.setGlobalProperty("app_version", 
                         withValue: "1.2.3", 
                         overrideExisting: true)

config.setGlobalProperty("user_type", 
                         withValue: "free", 
                         overrideExisting: true)

shortLinkResolveTimeOut

SingularConfig.shortLinkResolveTimeOut Property

Sets the timeout in seconds for resolving short links. This determines how long the SDK will wait for a short link to resolve before continuing with initialization. Default value is 10 seconds.

Signature

@property (assign) long shortLinkResolveTimeOut;

Usage Example

Swift Objective-C
// Set short link resolve timeout to 15 seconds
config.shortLinkResolveTimeOut = 15

singularLinksHandler

SingularConfig.singularLinksHandler Property

Sets a callback function to handle deep links processed by Singular. This allows your app to respond to deep links used in attribution.

Signature

@property (copy) void(^singularLinksHandler)(SingularLinkParams *);

Usage Example

Swift Objective-C
// Set singular links handler
config.singularLinksHandler = { params in
    guard let params = params else { return }

    // Check if we have a deep link
    if let deeplink = params.getDeepLink() {
        print("Deep link received: \(deeplink)")

        // Navigate based on the deep link
        self.navigateToScreen(deeplink)
    }

    // Check if this is a deferred deep link
    if params.isDeferred() {
        print("This is a deferred deep link")
    }

    // Access passthrough parameters
    if let passthrough = params.getPassthrough() {
        print("Passthrough data: \(passthrough)")
    }
}

skAdNetworkEnabled

SingularConfig.skAdNetworkEnabled Property

Enables or disables SKAdNetwork support. This controls whether the SDK will use Apple's SKAdNetwork for attribution. Default value is YES.

Signature

@property (assign) BOOL skAdNetworkEnabled;

Usage Example

Swift Objective-C
// Disable SKAdNetwork support if needed
config.skAdNetworkEnabled = false

supportAppExtension

SingularConfig.supportAppExtension Property

Enables support for app extensions. When enabled, the SDK can function properly in app extension contexts.

Signature

@property (assign) BOOL supportAppExtension;

Usage Example

Swift Objective-C
// Enable app extension support
config.supportAppExtension = true

userActivity

SingularConfig.userActivity Property

Sets the user activity object for handling universal links. This is used when the app is opened via a universal link.

Signature

@property (strong) NSUserActivity *userActivity;

Usage Example

Swift Objective-C
// Set user activity for universal links
func application(_ application: UIApplication, 
                 continue userActivity: NSUserActivity, 
                 restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    let config = SingularConfig(apiKey: "API_KEY", andSecret: "SECRET")
    config.userActivity = userActivity
    Singular.start(config)
    return true
}

waitForTrackingAuthorizationWithTimeoutInterval

SingularConfig.waitForTrackingAuthorizationWithTimeoutInterval Property

Sets the timeout interval in seconds to wait for the user's tracking authorization response on iOS 14+. This determines how long the SDK will wait for the AppTrackingTransparency prompt response before continuing with initialization. Default value is 0 , which means the SDK does not wait and continues immediately.

Signature

@property (assign) NSInteger waitForTrackingAuthorizationWithTimeoutInterval;

Usage Example

Swift Objective-C
// Wait up to 60 seconds for ATT prompt response
config.waitForTrackingAuthorizationWithTimeoutInterval = 60

Complete Configuration Example

Comprehensive SDK Configuration

The following example demonstrates how to create a comprehensive configuration by setting multiple configuration properties together.

Complete Example

Swift Objective-C
// Create configuration with API credentials
let config = SingularConfig(apiKey: "SDK KEY", andSecret: "YOUR_SECRET")

// Set basic options
config.waitForTrackingAuthorizationWithTimeoutInterval = 60
config.clipboardAttribution = true

// Set global properties
config.setGlobalProperty("app_version", 
                         withValue: "1.2.3", 
                         overrideExisting: true)
config.setGlobalProperty("user_type", 
                         withValue: "premium", 
                         overrideExisting: true)

// Configure SKAdNetwork
config.skAdNetworkEnabled = true
config.manualSkanConversionManagement = false
config.conversionValueUpdatedCallback = { conversionValue in
    print("Conversion value updated: \(conversionValue)")
}

// Configure deep links
config.launchOptions = launchOptions
config.singularLinksHandler = { params in
    if let deeplink = params?.getDeepLink() {
        print("Deep link received: \(deeplink)")
        self.handleDeepLink(deeplink)
    }
}

// Configure attribution callback (fires on a background queue)
config.deviceAttributionCallback = { attributionData in
    print("Attribution data: \(attributionData ?? [:])")
}

// Start the SDK
Singular.start(config)