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 protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]