ドキュメントで、ASIHTTPRequest を使用してアプリにカスタム進行状況追跡を実装する方法について読みました。2 つのメソッドの実装について言及していrequest:didReceiveBytes:
ますrequest:incrementDownloadSizeBy:
。これらをView Controllerに追加しましたが、呼び出されていません。この時点で、サンプル コードを機能させようとしています。
// ViewController.m
- (void)fetchThisURLFiveTimes:(NSURL *)url
{
[myQueue cancelAllOperations];
[myQueue setDownloadProgressDelegate:self];
[myQueue setDelegate:self];
[myQueue setRequestDidFinishSelector:@selector(queueComplete:)];
int i;
for (i=0; i<5; i++) {
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
request.showAccurateProgress = YES;
[myQueue addOperation:request];
}
myQueue.showAccurateProgress = YES;
[myQueue go];
}
- (void)queueComplete:(ASINetworkQueue *)queue
{
NSLog(@"Value: %f", [myProgressIndicator progress]);
}
- (void)request:(ASIHTTPRequest *)request didReceiveBytes:(long long)bytes
{
NSLog(@"bytes: %lld", bytes);
}
- (void)request:(ASIHTTPRequest *)request incrementDownloadSizeBy:(long long)newLength
{
NSLog(@"newLength: %lld", newLength);
}
ここで何が間違っていますか?