File Download on IOS - Swift

0

I'm just programming a little time for IOS using the SWIFT language.

I need to download a web file, I'm using NSURLSessionConfiguration, but this object only works for IOS 8+. And I want the app to run on devices with IOS 7+. Does anyone know how I can get around this?

func download(url: NSURL)
{
    self.url = url

    if #available(iOS 8.0, *) {
        let sessionConfig = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(url.absoluteString)
        let session = NSURLSession(configuration: sessionConfig, delegate: self, delegateQueue: nil)
        let task = session.downloadTaskWithURL(url)
        task.resume()
    } else {
        //Tratar para fazer download para versão 7
    }
    
asked by anonymous 13.05.2016 / 16:24

1 answer

-1

According to the documentation, NSURLSession and NSURLSessionConfiguration work on iOS 7.

Source:

NSURLSession Class Reference

NSURLSessionConfiguration Class Reference

    
27.05.2016 / 14:53