• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Trouble With NSURLSession...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble With NSURLSession...


  • Subject: Trouble With NSURLSession...
  • From: "Peters, Brandon" <email@hidden>
  • Date: Wed, 17 Jun 2015 02:42:51 +0000
  • Thread-topic: Trouble With NSURLSession...

Hello,

I am creating a class to handle downloading my app’s data. I am using Xcode with iOS 8.4 SDK and I keep getting from the compiler that there is no initializer for NSURLSession that accepts the list of arguments I am using:


import UIKit

class HSNDataManager: NSObject, NSURLSessionDelegate, NSURLSessionTaskDelegate,
NSURLSessionDownloadDelegate {

    static let dataManager = HSNDataManager()

    class func getRemoteData() {
        // url session configuration
        let urlSessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration()
        // create url session for downloading our sites database file
        var urlSession = NSURLSession(configuration: urlSessionConfiguration, delegate: self, delegateQueue: nil)
        // server location with file name
        if let url = NSURL(string: HSNConstants.sitesDBFileName) {
            // task type for location
            let downloadSessionTask = urlSession.downloadTaskWithURL(url)
            // start downloading DB
            downloadSessionTask.resume()
        }
    }

    func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didResumeAtOffset fileOffset: Int64, expectedTotalBytes: Int64) {

    }

    func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {

    }

    func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didFinishDownloadingToURL location: NSURL) {

    }

    func URLSession(session: NSURLSession, task: NSURLSessionTask, didCompleteWithError error: NSError?) {

    }

}

But the signature appears in the documentation/API reference. Why would the compiler say this when  it actually compiled fine when the code snippet resided in another .swift module?

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Trouble With NSURLSession...
      • From: "Peters, Brandon" <email@hidden>
  • Prev by Date: Re: AppDelegate vs Custom View Controllers for Download Task...
  • Next by Date: Trouble With NSURLSession...
  • Previous by thread: Re: AppDelegate vs Custom View Controllers for Download Task...
  • Next by thread: Re: Trouble With NSURLSession...
  • Index(es):
    • Date
    • Thread