PCSDKModule Documentation

Class PCSDK

public final class PCSDK  

The root class of The PCSDK

Configures initial variables, setting up logging levels

Nested Types

PCSDK.Mode

SDK's using mode

Properties

version

public static var version: String  

The current version of the SDK (e.g. 5.0.265)

api​Version

public static var apiVersion: Int  

The maximum supported version of the server API

now

public static var now: Date  

The current date with synced time offset

default​Database​File​Name

public static let defaultDatabaseFileName: String = "PCStorage.sqlite"

The default database file name

url​Session

public static var urlSession: URLSession = .sdkSession

The instance of URLSession with .ephemeral configuration which performs all network requests.

location​Updates​Frequency

public static var locationUpdatesFrequency: TimeInterval = 30

The frequency in seconds of collecting data about the current location.

Location data is collected and attached to the request bodies if the user and the server have given the appropriate permissions.

Default value

5 seconds.

default​Database​URL

public private(set) static var defaultDatabaseURL: URL  

The default url for users database

logger

public private(set) static var logger: PCLoggerProtocol  

The PCSDK assigned logger

fixed​API

public static var fixedAPI: Bool = false

Using the API version passed when importing the user

By default false, which means that at the first request to the server, an additional request will also be made to find out the API version.

If the parameter is set to true, the version request will not be executed, the version that was passed when importing the user will be used.

requests​Timeout​Interval

public static var requestsTimeoutInterval = 30.0

The timeout interval of network requests. The default value is 30 seconds

Methods

initialize(database​URL:​access​Group:​mode:​)

public static func initialize(
        databaseURL: URL? = nil,
        accessGroup: String? = nil,
        mode: Mode = .app
    )  

Initializes the SDK

Parameters

database​URL URL?

The url for storing users data. If it is not set - SDK will use the default URL provided by PCSDK.defaultDatabaseURL property

access​Group String?

The access group to store new Keychain's keys. If not set, the default access group will be used (app ID or Keychain Access Group).

mode Mode

The SDK's using mode. When using SDK in extensions the main app bundle identifier should be provided. Location updates with granted "When In Use" permissions are not avaiable in extensions.

set​Handles​Background​Timeout(_:​)

public static func setHandlesBackgroundTimeout(_ timeout: TimeInterval)  

Sets background timeout for handles

Parameters

timeout Time​Interval

Timeout (in seconds)

set​Logger(_:​options:​)

public static func setLogger(
        _ logger: PCLoggerProtocol,
        options: PCLoggingOptions = .debug
    )  

Set custom logger with provided log level

Set the required level of logging:

  • .debug - shows SDK's debug information (default value)

  • .sensitive - shows sensitive data, e.g.: crypting keys, some requests with user info

Parameters

logger PCLogger​Protocol

The logger

options PCLogging​Options

The logging options

set​Log​Level(_:​)

public static func setLogLevel(_ logLevel: PCLoggingOptions)  

Configures the log level

Set the required level of logging:

  • .debug - shows SDK's debug information

  • .sensitive - shows sensitive data, e.g.: crypting keys, some requests with user info

Parameters

log​Level PCLogging​Options

The required level of logging (OptionSet).

check​Root()

public static func checkRoot() -> Bool  

Checking if device is jailbroken

Returns

true if jailbroken or false

analyze(qr​Value:​)

public static func analyze(qrValue: String) -> PCQRType  

Return the type of the QR code

Parameters

qr​Value String

The value from QR code

Returns

The instance of PCQRType

clear​Caches()

public static func clearCaches()  

Removes all cached binary data of transactions

remove​Local​Keypair()

@available(iOS 10.0, iOSApplicationExtension 10.0, *)
    public static func removeLocalKeypair()  

Removes the keypair for the device specific encryption and decryption

⚠️ Warning! All available users will be unusable anymore after removing. There is no way to restore deleted keys.

remove​All​Users()

public static func removeAllUsers()  

Removes all users and all corresponding data

⚠️ Warning! All users will be removed. There is no way to restore removed users.