/
Initialization (iOS SDK)

Initialization (iOS SDK)

Initialize SDK object and use it anywhere in your application.

Remember to initialize SDK only once on application launch. Don't forget to replace the %YOUR_STORE_KEY% text with the current store key from your PersonaClick account.

import PersonaClick

sdk = createPersonalizationSDK(
    shopId: "%YOUR_STORE_KEY%",
    apiDomain: "api.personaclick.com",
    enableLogs: false,
    parentViewController: (window?.rootViewController)!,
    needReInitialization: true,
    { error in
        # Assign the SDK instance to a global variable for reuse across the application.
        globalSDK = self.sdk

        # Notify other parts of the application about the successful initialization of the SDK.
        NotificationCenter.default.post(name: globalSDKNotificationNameMainInit, object: nil)
    }
)

Parameters

NameTypeRequirementDescription
shopIdstringrequiredThe current store key from the PersonaClick account.
apiDomainstringrequiredThe API domain for server communication.
enableLogsbooleanoptionallyEnable logs for debugging purposes during development.
parentViewControllercontrolleroptionallyThe view controller to display in-app notifications. To create a pop-up follow this way: Account -> Pop-ups -> Programmatic pop-ups -> Create -> For mobile application
needReInitializationbooleanoptionallyAllows reinitialization of the SDK and clears the local storage.
userEmailstringoptionallyUser Email.
userPhonestringoptionallyUser Phone.
userLoyaltyIdstringoptionallyThe Loyalty Program user ID (loyalty card).
autoSendPushTokenbooleanoptionallyThe true value (the default) allows the token to be requested, and false disallows it.

Related content

User Profile (iOS SDK)
User Profile (iOS SDK)
More like this
iOS SDK (Swift)
iOS SDK (Swift)
Read with this
Initialization (Android SDK - Kotlin)
Initialization (Android SDK - Kotlin)
More like this
Initialization (Android SDK - Java)
Initialization (Android SDK - Java)
More like this
Initialization (REST API)
Initialization (REST API)
More like this
Notifications (RN SDK)
Notifications (RN SDK)
More like this

Copyright 2018-2024 PersonaClick