The FMPConnection class is used to describe device connection to server.
class FMPConnection
Property | Description |
url |
Server URL. var url: String { get } |
environment | Environment name. var environment: String { get } |
project | Project name. var project: String { get } |
udid | Unique device identifier. var udid: String { get } |
api | API version. var api: String { get } |
isSSLChecksEnabled | The checkbox that determines whether SSL check is enabled. var isSSLChecksEnabled: Bool { get set } |
caFilePath | The path to pem file with certification authority certificate. var caFilePath: String { get set } |
Method | Description |
initialize() |
Determine settings of device connection to server. func initialize() |
status(completion:) | Check server availability. func status(completion: @escaping FMPRequestResponseHandler) Parameters:
|
Determine connection settings for Foresight Mobile Platform:
// Build an instance of the FMPConnection class with required connection settings. For details see examples for FMPConnection.Builder.
let connection: FMPConnection = fmp.connection
.url("http://url/")
.environment("environment")
.project("project")
.udid("udid")
.build()
// Determine connection settings for Foresight Mobile Platform
connection.initialize()
Check server availability:
// Build an instance of the FMPConnection class with required connection settings. For details see examples for FMPConnection.Builder.
let connection: FMPConnection = fmp.connection
.url("http://url/")
.build()
// Check server availability at the specified URL
connection.status(completion: { (response) in
if response.success {
// Server at the specified URL is available
} else {
// Server at the specified URL is not available. Display error code and description.
print(response.error?.code, response.error?.description)
}
})
Enable or disable SSL check:
// Build an instance of the FMPConnection class. For details see examples for FMPConnection.Builder.
let connection: FMPConnection = fmp.connection.build()
// Enable SSL check
connection.isSSLChecksEnabled = true
// Disable SSL check
connection.isSSLChecksEnabled = false
Change path to certification authority certificate:
// Build an instance of the FMPConnection class. For details see examples for FMPConnection.Builder.
let connection: FMPConnection = fmp.connection.build()
// Set path to certification authority certificate
connection.caFilePath = "path"
See also: