0

I'm using ASIHTTPRequest to track downloading but it doesn't seem to work.

I'm using the code shown in: How to Using ASIHTTPRequest to tracking Upload/Download progress, but Xcode errors out saying maxValue cannot be found.

Then I tried:

UIProgressView * myProgressIndicator;
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDownloadProgressDelegate:myProgressIndicator];
[request startSynchronous];
NSLog(@"Value: %f", [myProgressIndicator progress];

This failed as well. Can someone help?

Community
  • 1
  • 1
Webworth
  • 68
  • 1
  • 1
  • 7
  • FYI ASIRequest is not anymore supported. I advice to use something else. Regarding you question what do you expect to see? – Nekto Sep 24 '12 at 23:50
  • Thanks @Nekto, actually I want to use UIAlertView and UIProgressView to let user know the downloading status, but i cannot get values 'maxValue' and 'doubleValue' given by [link](http://stackoverflow.com/questions/4602812/how-to-using-asihttprequest-to-tracking-upload-download-progress) – Webworth Sep 25 '12 at 01:10

1 Answers1

0

The example code from the ASIHttpRequest website you're referring to is for a Mac application, not an iOS app. In the example code the delegate object is an instance of NSProgressIndicator, but that class is not available in iOS. Instead, when using ASIHttpRequest in iOS the delegate object should be a UIProgressView instance.

UIProgressView does not have maxValue or a doubleValue properties. UIProgressView instead has a progress property, which is a float that can take values between 0.0 (0% complete) and 1.0 (100% complete).

You can learn more about the UIProgressView class here.

jonkroll
  • 15,682
  • 4
  • 50
  • 43
  • Thx @jonkroll , but I try code `UIProgressView * myProgressIndicator; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDownloadProgressDelegate:myProgressIndicator]; [request startSynchronous]; NSLog(@"Value: %f", [myProgressIndicator progress];` as I writen before, there is also no log be displayed, so why? – Webworth Sep 25 '12 at 06:34
  • In that code you are declaring a `UIProgressView` local variable but you are not instantiating an object anywhere, so `myProgressIndicator` is null. – jonkroll Sep 25 '12 at 16:02