ios: NSURLSessionDataTask and download from different views -


Now I try to apply background file download in my iOS app, and I'm a bit confused ... I have many different looks in my app, and I want to start downloading many of these files, and progress has been shown in this scene. By creating an NSURL session in App Rep in the first part of my purpose (downloading files) was applied, so I can get it in any form and start downloading a file.

AppDelegat

  NSURL session configuration * Session configuration = [NSUrlSystem integration page with report bill: @ "com.myEnglishLessons"]; Session configuration. HTTPMXConclusionHost = 111; Self.currentSession = [NSURL session session with configuration: session configuration rep: zero rep: question: zero];  

In some view

  NSURLSessionDataTask * downloadTask = [[AppDelegate *] [[UIApplication shared application] representative] currentSession] downloadTaskWithURL: myURL] ; [Download Task Resume];  

All this works well, but what is the problem - I can not handle the progress and progress in this scene. Representative of the NSURL session is unusual, so it provides the process of downloading the process, but not the square of the view. Can you recommend me?

You can use the downloadTask.taskDescription to set the view Name of the ID or the View Class So when you create a task from the view, you can type in:

  NSURLSessionDataTask * downloadTask = [[(AppDelegate *) [[UIApplication shared application] Representative] currentSession] downloadTaskWithURL: myURL]; [Download Task Settask Discription: NSStringFromClass ([Self class])]; [Download Task Resume];  

You can then send the notification in progress URL session method:

  Sijiflot progress = (Sijiflot) Kulbits writing / total Baitsaksacitutpad; [[NSNotificationCenter defaultCenter] postNotificationName: kDownloadTaskProgressNotification object: zero user information: @ {@ "Progress": @ (progress), @ "viewClass": downloadTask.taskDescription];  

And all ideas should follow this notification. You will also need to add a class check if you get a notification.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -