代码之家  ›  专栏  ›  技术社区  ›  Webworth

ASIHTTPRequest跟踪下载进度不起作用

  •  0
  • Webworth  · 技术社区  · 12 年前

    我正在使用ASIHTTPRequest来跟踪下载,但它似乎不起作用。

    我正在使用中显示的代码: How to Using ASIHTTPRequest to tracking Upload/Download progress ,但Xcode错误地说 maxValue cannot be found

    然后我试着:

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

    这也失败了。有人能帮忙吗?

    1 回复  |  直到 7 年前
        1
  •  0
  •   jonkroll    12 年前

    您所指的ASIHttpRequest网站上的示例代码适用于Mac应用程序,而不是iOS应用程序。在示例代码中,委托对象是 NSProgressIndicator ,但该类在iOS中不可用。相反,在iOS中使用ASIHttpRequest时,委托对象应该是 UIProgressView 例子

    UIProgressView没有maxValue或doubleValue属性。UIProgressView改为具有 progress 属性,它是一个浮点值,可以取0.0(完成0%)到1.0(完成100%)之间的值。

    您可以了解更多关于 UI进度视图 here