When checking the download, is checking for "progress == 1.0" ok? Or should it be> =?
In NSURLSession, when my file is uploaded, I track the progress with:
CGFloat progress = (CGFloat)totalBytesWritten / (CGFloat)totalBytesExpectedToWrite;
To update the on-screen indicator. I need to make sure that when the download is complete, even though the indicator disappears, as in my case I will show the loaded image.
Is it if (progress == 1.0) { ... }normal as a check? This may seem silly, but I want to make sure that there are no cases that I am not considering, because in the past I was a bit weird result of dividing with programming, maybe it will return 1.000000either 1.0000001828111or something, or it can even do something like 0.99999999999999999?
:
CGFloat progress = (CGFloat)totalBytesWritten / (CGFloat)totalBytesExpectedToWrite;
progress == 1.0, (CGFloat)totalBytesWritten == (CGFloat)totalBytesExpectedToWrite . , , , totalBytesWritten == totalBytesExpectedToWrite, , , . , , , , . , ( "edit" ) Arkku - : , 1.0, totalBytesWritten == totalBytesExpectedToWrite .