UsherSDK

@objc
public class UsherSDK : NSObject

The primary entry point for all apps using UsherAccountSDK. Every app that uses the UsherAccountSDK needs to initialize it with an UsherSDKConfiguration object. This class also provides other high level APIs such as resetting all user data.

  • Boolean that can be used to check if the SDK has completed initialization.

    Declaration

    Swift

    @objc
    public private(set) static var isInitialized: Bool
  • The UsherSDK needs to be initialized with a configuration before any of its APIs are called. Attempting to use the SDK’s APIs without initialization will result in errors or undefined behaviors. Wait for completion of this method before performing any API calls to the SDK.

    Note

    The static property of UsherSDK, isInitialized can also be used to check if the SDK has completed initialization.

    Declaration

    Swift

    @objc
    public static func initializeWith(configuration: UsherSDKConfiguration, completion: @escaping (NSError?) -> Void)
    Parameters
    configuration

    A value of type UsherSDKConfiguration

    completion

    A completion block called post initialization. Wait for this completion before performing any API call to the UsherAccountSDK.

  • Update the Apple push notification token associated with the device on the server.

    Declaration

    Swift

    @objc
    public static func updateAPNSToken(_ token: String, environment: APNSEnvironment, completion: @escaping (NSError?) -> Void)
    Parameters
    token

    APNS token.

    environment

    APNSEnvironment.

    completion

    Completion block that will be called once update is done.

    • environment: APNSEnvironment.

  • Set the locale of UsherAccountSDK.

    Declaration

    Swift

    @objc
    public static func setLocale(_ locale: Locale)
    Parameters
    locale

    Information about linguistic, cultural, and technological conventions for use in formatting data for presentation. It is used to generate localized strings from UsherAccountSDK.

  • Get the locale of UsherAccountSDK.

    Declaration

    Swift

    @objc
    public static func getLocale() -> Locale
    Return Value

    Information about linguistic, cultural, and technological conventions for use in formatting data for presentation. It is used to generate localized strings from UsherAccountSDK.

  • The SDK log file URL.

    Declaration

    Swift

    @objc
    public static var logFileUrl: URL { get }
  • Set Debug Log Mode in User Defaults.

    Declaration

    Swift

    @objc
    public static func setDebugLogMode(_ isDebugLogMode: Bool)
    Parameters
    debugMode

    Boolean value for debug mode.

  • Get Debug Log Mode from User Defaults.

    Declaration

    Swift

    @objc
    public static func isDebugLogMode() -> Bool
  • Discards all data from the iOS Keychain except the deviceID. Resets “keepMeSignIn” to false. Discards accessToken and currentUser. This will not reset the UsherSDK.isDebugLogMode(), serverURL, and AccountManager.isBiometricLoginEnabled in UserDefaults. (Objective-C backward compatibility)

    Declaration

    Swift

    @objc
    public class func reset(keepDeviceId: Bool = true)
    Parameters
    keepDeviceId

    Whether you want to keep the device ID when you reset the SDK. The default value is true.

  • Discards all data from the iOS Keychain except the deviceID. Resets “keepMeSignIn” to false. Discards accessToken and currentUser. This will not reset the UsherSDK.isDebugLogMode(), serverURL, and AccountManager.isBiometricLoginEnabled in UserDefaults. (Objective-C backward compatibility)

    Declaration

    Swift

    @objc
    public class func reset()
  • Change the server URL to the provided URL string.

    Note

    Local cache will be cleared after successfully changing server.

    Throws

    .invalidServerUrl (Error Code 10006), if the server URL string is invalid, e.g. empty string.
    Declaration

    Swift

    @objc
    public static func changeServerURL(_ url: String) throws
    Parameters
    url

    The url string which UsherAutoSDK will change to.

  • Get the server URL that UsherAutoSDK is currently using.

    Note

    Empty string will be returned if no server URL has been set.
    Declaration

    Swift

    @objc
    public static func getServerURL() -> String
    Return Value

    The server URL string that UsherAutoSDK is currently using.