Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. A background URLSession with identifier com.example.DownloadTaskExample.background already exists!
  2.  
  3. var backgroundSession: URLSession!
  4. var index = 0
  5.  
  6. override func viewDidLoad() {
  7. super.viewDidLoad()
  8. let sessionConfig = URLSessionConfiguration.background(withIdentifier: "com.example.Example.background")
  9. backgroundSession = URLSession(configuration: sessionConfig, delegate: self, delegateQueue: OperationQueue())
  10. }
  11.  
  12. let url = URL(string: "link")!
  13. let downloadTask1 = ViewController.backgroundSession.downloadTask(with: url)
  14. downloadTask1()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement