0

I'm writing an iOS app in Swift 3.0.1 and Xcode 8.1. I am attempting to download a file from the internet programatically.

let configuration = URLSessionConfiguration.default
let session = URLSession(configuration: configuration, delegate: self, delegateQueue: nil)

Somehow this call above is not liked by Xcode. I'm not sure what I am missing.

EDIT:

This is where I'm using this call. Inside of this I get a different error, though. "Use of instance member 'URLSession' on type 'AdvancedSettingsTableViewController'; did you mean to use a value of type 'AdvancedSettingsTableViewController' instead?"

lazy var downloadSession: URLSession = {
    let configuration = URLSessionConfiguration.default
    let session = URLSession(configuration: configuration, delegate: self, delegateQueue: nil)
    return session
}()

EDIT 2: It almost seems like it doesn't recognize

init(configuration: URLSessionConfiguration, delegate: URLSessionDelegate?, delegateQueue queue: OperationQueue?)

as a valid initializer. If I command click on URLSession I get a question mark.

1 Answers1

0

It happened to me as well and it seems that it was caused by other problems with the code. After fixing other issues in the file, it stopped complaining.

Maciej Trybiło
  • 1,187
  • 8
  • 20