2 Replies
      Latest reply: Nov 11, 2016 10:29 AM by Phred RSS
      Phred Level 1 Level 1 (0 points)

        Is URLSession init(configuration:delegate:delegateQueue:) Working

        when I try:

         

                var configuration = URLSessionConfiguration.default

                var session = URLSession(configuration: configuration, delegate: self, queue: nil)

         

        I get errors and XCode want me to change methods

        • Re: Is URLSession init(configuration:delegate:delegateQueue:) Working
          eskimo Apple Staff Apple Staff (6,270 points)

          When I put this code into a new iOS app test project, Xcode gives the following error:

          …/ViewController.swift:17:33: error: incorrect argument label in call (have 'configuration:delegate:queue:', expected 'configuration:delegate:delegateQueue:')
                  var session = URLSession(configuration: configuration, delegate: self, queue: nil)
                                          ^                                              ~~~~~
                                                                                        delegateQueue
          

          That seems pretty self explanatory and, if not, Xcode gives you a fix-it to make the change.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: Is URLSession init(configuration:delegate:delegateQueue:) Working
              Phred Level 1 Level 1 (0 points)

              In the light of day everything become clearer.

               

              I was trying to implement some old example for implementing the delegate and the methods started with "URLSession(" and for some reason XCode could not see the Foundation definitions. Using "Foundation.URLSession(" allowed me to use the method, but fixing the actual delegate methods fixed the real problem.