I think you are over complicating the math with boxing and unboxing of datatypes with NSNumber.
What I would do is create three variables:
double fileLength;
double lastProgress;
double currentLength;
Then do simple math:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
fileLength = [response expectedContentLength];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)d {
double length = [d length];
currentLength += length;
double progress = currentLength/fileLength;
if (lastProgress < progress) {
profileProgressView.progress = progress;
lastProgress = progress;
}
}