在iphone应用程序下载多个文件(目标c) [英] Downloading multiple files in iphone app(Objective c)

查看:112
本文介绍了在iphone应用程序下载多个文件(目标c)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iPhone应用程序,我想下载多个文件,在IIS上的认证。在按钮上点击我想开始下载过程。



我知道如何使用身份验证下载文件。

  NSURLRequest * request = 
[NSURLRequest requestWithURL:mMovieURL
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
movieConnection =
[[NSURLConnection alloc] initWithRequest:request delegate:self];

并且我有两个代理方法与上述代码。


$


$ b $ p

解决方案

我之前做过,当我想同时下载10个XML文件(这是速度比排队他们一个接一个下)。我使用了这里找到的库:



http://github.com/leonho/iphone-libs/tree/master



它们很容易实现,有一些示例代码

  self.urls = [NSMutableArray arrayWithObjects:
@http:// maps .google.com / maps / geo?output = json& q = Lai + Chi + Kok,Hong + Kong,
@http://maps.google.com/maps/geo?output=json& q = Central,Hong + Kong,
@http://maps.google.com/maps/geo?output=json&q=Wan+Chai,Hong+Kong,
nil] ;

self.downloads = [[MultipleDownload alloc] initWithUrls:urls];
self.downloads.delegate = self;

祝你好运。


In my iPhone app I want to download multiple files which are on IIS with authentication. On a button click i want to start the downloading process.

I know how to download a file with authentication.

    NSURLRequest* request =
               [NSURLRequest requestWithURL:mMovieURL 
                             cachePolicy:NSURLRequestUseProtocolCachePolicy 
                             timeoutInterval:60.0];
    movieConnection =
            [[NSURLConnection alloc] initWithRequest:request delegate:self ];

and i have couple of delegate methods with the above code.

But how to do it with mutliple downlaods going at the same time.

Thanks,

解决方案

I've done this before when I wanted to download 10 XML files at the same time (it was much faster than queuing them to download one after the other). I used the libraries found here:

http://github.com/leonho/iphone-libs/tree/master

They were easy to implement and there's some example code on the front page to get you started.

self.urls = [NSMutableArray arrayWithObjects:
    @"http://maps.google.com/maps/geo?output=json&q=Lai+Chi+Kok,Hong+Kong",
    @"http://maps.google.com/maps/geo?output=json&q=Central,Hong+Kong",
    @"http://maps.google.com/maps/geo?output=json&q=Wan+Chai,Hong+Kong",
    nil];

self.downloads = [[MultipleDownload alloc] initWithUrls: urls];
self.downloads.delegate = self;

Good luck.

这篇关于在iphone应用程序下载多个文件(目标c)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆