Skip to content

Commit

Permalink
Fixes unrecognized selector for 'taskIdentifier' and 'originalRequest…
Browse files Browse the repository at this point in the history
…' methods

- Adds 'taskIdentifier' and 'originalRequest' methods for SessionUploadTask
and SessionDownloadTask
  • Loading branch information
nebiros committed Apr 9, 2018
1 parent 1b7ccc8 commit c9f9cba
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 0 additions & 1 deletion DVR/SessionDataTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ final class SessionDataTask: URLSessionDataTask {
return _originalRequest
}


// MARK: - Initializers

init(session: Session, request: URLRequest, completion: (Completion)? = nil) {
Expand Down
14 changes: 14 additions & 0 deletions DVR/SessionDownloadTask.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
private var globalTaskIdentifier: Int = 100000

final class SessionDownloadTask: URLSessionDownloadTask {

// MARK: - Types
Expand All @@ -10,6 +12,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 DVR/SessionUploadTask.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
private var globalTaskIdentifier: Int = 100000

final class SessionUploadTask: URLSessionUploadTask {

// MARK: - Types
Expand All @@ -11,6 +13,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

0 comments on commit c9f9cba

Please sign in to comment.