View重新加载时在后台运行ASIHTTPRequest

时间:2014-01-25 05:17:23

标签: ios asihttprequest nsurl

我正在开发一个使用ASIHTTPRequest从服务器下载内容的应用程序。下载时,如果我从纵向移动到横向模式,则下载过程将停止。我还需要继续下载过程。

我在stackoverflow中搜索了解决方案但没有用。

我该如何解决这个问题...

这是我用来下载的一段代码。

   NSURL *downloadURL = [publisher contentURLForIssueWithName:issueTitle];

    if (!networkQueue) {
        networkQueue = [[ASINetworkQueue alloc] init];
    }

    if(!downloadURL) return;
    [self performSelectorInBackground:@selector(read) withObject:nil];

    request = [ASIHTTPRequest requestWithURL:downloadURL];
    [request setDelegate:self];
    [request setDownloadProgressDelegate:progressView];
    [request setShowAccurateProgress:YES];
    request.shouldContinueWhenAppEntersBackground=YES;
    request.allowResumeForFileDownloads=YES;
    [request startAsynchronous];

任何帮助都值得赞赏..

0 个答案:

没有答案