Class
PCSDK
final public 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
version
var version: String
The current version of the SDK (e.g. 5.0.265)
apiVersion
var apiVersion: Int
The maximum supported version of the server API
now
var now: Date
The current date with synced time offset
defaultDatabaseFileName
let defaultDatabaseFileName: String = "PCStorage.sqlite"
The default database file name
urlSession
var urlSession: URLSession = .sdkSession
The instance of URLSession
with .ephemeral
configuration which performs all network requests.
defaultDatabaseURL
var defaultDatabaseURL: URL
The default url for users database
requestsTimeoutInterval
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
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.