Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unrecognized selector error for 'taskIdentifier' and 'originalRequest' methods #77

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
14 changes: 14 additions & 0 deletions Sources/DVR/SessionDataTask.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Foundation

private var globalTaskIdentifier: Int = 100000

final class SessionDataTask: URLSessionDataTask {

// MARK: - Types
Expand All @@ -19,6 +21,18 @@ final class SessionDataTask: URLSessionDataTask {
return interaction?.response
}

var _taskIdentifier: Int = {
globalTaskIdentifier += 1
return globalTaskIdentifier
}()
override var taskIdentifier: Int {
return _taskIdentifier
}

var _originalRequest: URLRequest?
override var originalRequest: URLRequest? {
return _originalRequest
}

// MARK: - Initializers

Expand Down
14 changes: 14 additions & 0 deletions Sources/DVR/SessionDownloadTask.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Foundation

private var globalTaskIdentifier: Int = 200000

final class SessionDownloadTask: URLSessionDownloadTask {

// MARK: - Types
Expand All @@ -12,6 +14,18 @@ final class SessionDownloadTask: URLSessionDownloadTask {
let request: URLRequest
let completion: Completion?

var _taskIdentifier: Int = {
globalTaskIdentifier += 1
return globalTaskIdentifier
}()
override var taskIdentifier: Int {
return _taskIdentifier
}

var _originalRequest: URLRequest?
override var originalRequest: URLRequest? {
return _originalRequest
}

// MARK: - Initializers

Expand Down
15 changes: 15 additions & 0 deletions Sources/DVR/SessionUploadTask.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Foundation

private var globalTaskIdentifier: Int = 300000

final class SessionUploadTask: URLSessionUploadTask {

// MARK: - Types
Expand All @@ -13,6 +15,19 @@ final class SessionUploadTask: URLSessionUploadTask {
let completion: Completion?
let dataTask: SessionDataTask

var _taskIdentifier: Int = {
globalTaskIdentifier += 1
return globalTaskIdentifier
}()
override var taskIdentifier: Int {
return _taskIdentifier
}

var _originalRequest: URLRequest?
override var originalRequest: URLRequest? {
return _originalRequest
}

// MARK: - Initializers

init(session: Session, request: URLRequest, completion: Completion? = nil) {
Expand Down