usePreconfiguredSession

fun usePreconfiguredSession(session: NSURLSession, delegate: KtorNSURLSessionDelegate)

Set a session to be used to make HTTP requests. If the preconfigured session is set, configureSession and handleChallenge blocks will be ignored.

The session must be created with KtorNSURLSessionDelegate as a delegate.

val delegate = KtorNSURLSessionDelegate()
val session = NSURLSession.sessionWithConfiguration(
NSURLSessionConfiguration.defaultSessionConfiguration(),
delegate,
delegateQueue = null
)

usePreconfiguredSession(session, delegate)

See also


fun usePreconfiguredSession(session: NSURLSession?)

Deprecated (with error)

Please use method with delegate parameter

Set a session to be used to make HTTP requests, null to create default session. If the preconfigured session is set, configureSession block will be ignored.