Monday, 15 March 2010

ios - Extra argument 'completionHandler' in call with NSURLSession.sharedSession() -


When I NSURL session and NSURLSession.sharedSession () , I can show this additional logic 'completionHandler' in the call, this error What could be the reason?

My code:

  Share session = NSURL session. Shared session () Let's download: NSURLSessionDownloadTask = sharedSession.downloadTaskWithURL (forecastURL, completionHandler: {(location: NSURL !, feedback: NSRLResponse !, error: NSError!) -> println (answer)} in Zero! DownloadTask Resume ()  

use dataTaskWithRequest Here's a sample How do I download the image

  var dowloadTask = session.dataTaskWithRequest (urlRequest, completionHandler: {(Data: NSData !, Response: NSURLResponse !, Error: NSError!) -> Zero // Image for Image Image = UIImage (Data: Data) Image if! = Zero {// Something Samant / / Preview dispatch_async (dispatch_get_main_queue (), {() -> zero in self.image = image})}} DowloadTask.resume ()  

No comments:

Post a Comment