Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A background URLSession with identifier com.example.DownloadTaskExample.background already exists!
- var backgroundSession: URLSession!
- var index = 0
- override func viewDidLoad() {
- super.viewDidLoad()
- let sessionConfig = URLSessionConfiguration.background(withIdentifier: "com.example.Example.background")
- backgroundSession = URLSession(configuration: sessionConfig, delegate: self, delegateQueue: OperationQueue())
- }
- let url = URL(string: "link")!
- let downloadTask1 = ViewController.backgroundSession.downloadTask(with: url)
- downloadTask1()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement