Integration
Integrate SuprSend SDK in your Swift project
SuprSendSdk
is deprecated. Please migrate to SuprSend
SDK
This documentation is for new version of iOS sdk. If you are using older version of sdk SuprSendSdk
please refer documentation
Installation
There are two ways you can install SuprSend SDK into your app:
Integration
Create Client
Import SDK inside AppDelegate.swift
and then initialize the SuprSend class inside application(_:didFinishLaunchingWithOptions:)
method.
Params | Description |
---|---|
publicApiKey* | This is public Key used to authenticate API calls to SuprSend. Get it in SuprSend dashboard ApiKeys -> Public Keys section |
Authenticate User
Authenticate user so that all the actions performed after authenticating will be w.r.t that user. This is mandatory step and need to be called before using any other method. This is usually performed after successful login and on reload of page to re-authenticate user.
Properties | Description |
---|---|
distinctId* | Unique identifier to identify a user across platform. |
userToken | Mandatory when enhanced security mode is on. This is ES256 JWT token generated in your server-side. Refer docs to create userToken. |
refreshUserToken | This function is called by SDK internally to get new userToken before existing token is expired. The returned string is used as the new userToken. |
Returns: async -> APIResponse
2.1 Check if user is authenticated
This method will check if user is authenticated i.e. distinctId
is attached to SuprSend instance. To check for userToken also pass checkUserToken flag true.
Reset user
This will remove user data from SuprSend instance. This is usually called on logout action.
Returns: async -> APIResponse