Class
PCSDK
public final class PCSDK
The root class of The PCSDK
Configures initial variables, setting up logging levels
Relationships
Nested Types
PCSDK.Mode
SDK's using mode
Properties
defaultDatabaseFileName
public static let defaultDatabaseFileName: String = "PCStorage.sqlite"
The default database file name
urlSession
public static var urlSession: URLSession = .sdkSession
The instance of URLSession
with .ephemeral
configuration which performs all network requests.
locationUpdatesFrequency
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.
defaultDatabaseURL
public private(set) static var defaultDatabaseURL: URL
The default url for users database
fixedAPI
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.
requestsTimeoutInterval
public static var requestsTimeoutInterval = 30.0
The timeout interval of network requests. The default value is 30 seconds
Methods
initialize(databaseURL:accessGroup:mode:)
public static func initialize(
databaseURL: URL? = nil,
accessGroup: String? = nil,
mode: Mode = .app
)
Initializes the SDK
Parameters
Name | Type | Description |
---|---|---|
databaseURL | URL? |
The url for storing users data. If it is not set - SDK will use the default URL provided by |
accessGroup | 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. |
setHandlesBackgroundTimeout(_:)
public static func setHandlesBackgroundTimeout(_ timeout: TimeInterval)
Sets background timeout for handles
Parameters
Name | Type | Description |
---|---|---|
timeout | TimeInterval |
Timeout (in seconds) |
setLogger(_: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
Name | Type | Description |
---|---|---|
logger | PCLoggerProtocol |
The logger |
options | PCLoggingOptions |
The logging options |
setLogLevel(_:)
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
Name | Type | Description |
---|---|---|
logLevel | PCLoggingOptions |
The required level of logging (OptionSet). |
checkRoot()
public static func checkRoot() -> Bool
Checking if device is jailbroken
Returns
true
if jailbroken or false
analyze(qrValue:)
public static func analyze(qrValue: String) -> PCQRType
Return the type of the QR code
Parameters
Name | Type | Description |
---|---|---|
qrValue | String |
The value from QR code |
Returns
The instance of PCQRType
removeLocalKeypair()
@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.
removeAllUsers()
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.