일부 데이터를 서버에 업로드하기 위해 POST 요청을 사용 중이고 NSURLConnection
의 메서드의 totalBytesWritten
속성을 기반으로 UIProgressView의 진행률을 업데이트하려고합니다. 아래 코드를 사용하면 진행률보기를 적절하게 업데이트하지 못합니다. 완료 될 때까지 항상 0.000입니다. 업로드를 더 잘 진행하기 위해 무엇을 배가하거나 나누어야할지 모르겠습니다.NSURLConnection didSendBodyData 진행
제공되는 도움에 감사드립니다. 코드 :
- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite
{
NSNumber *progress = [NSNumber numberWithFloat:(totalBytesWritten/totalBytesExpectedToWrite)];
NSLog(@"Proggy: %f",progress.floatValue);
self.uploadProgressView.progress = progress.floatValue;
}