问题描述:

I am getting a exponential value for the expected downloadable size in NSURLConnectionDelegate.

its showing as 1.34597e+08

Now I am trying to convert the value to 1.3459 using the below code but with no luck

 self.expectedDownloadSize = Float(response.expectedContentLength)

let s = self.expectedDownloadSize.description

let numberFormatter = NSNumberFormatter()

numberFormatter.numberStyle = NSNumberFormatterStyle.DecimalStyle

numberFormatter.maximumFractionDigits = 4

var num = numberFormatter.numberFromString(s as String)

self.expectedDownloadSize = num?.floatValue

Please help me getting the expected size of download.

相关阅读:
Top