如何改变NSURLConnection的优先级?

我正在开发一个音乐应用程序,它使用ASIHTTPRequest访问服务器的API,并使用NSURLConnection来下载音乐文件。

一个音乐文件是10M左右。 下载音乐文件时,访问服务器的api将比下载音乐文件慢得多。

所以我想更改下载连接的优先级。 但没有改变NSURLConnectionNSURLRequest优先级的API。

如何归档这个?

我认为只有NSOperationQueues可以被优先考虑。 这里是一个例子的链接: http : //eng.pulse.me/tag/nsurlconnection/

另一种方法是,在其他下载完成后停止下载音乐文件。 要做到这一点,你可以告诉ASIHTTP将下载保存到一个文件,并根据要求恢复。

以下是我的一个项目的例子:

 - (void) executeFileDownloadAtURL:(NSURL *) aURL toDirectory:(NSString *) aDestinationPath; { self.request = [ASIHTTPRequest requestWithURL:aURL]; [self.request setDownloadDestinationPath:aDestinationPath]; self.request.downloadProgressDelegate = self.delegate; [self.request setAllowResumeForFileDownloads:YES]; NSString *tmpDir = NSTemporaryDirectory(); NSString *tempFilePath = [NSString stringWithFormat:@"%@%@", tmpDir, @"TempMovie.mp4"]; [self.request setTemporaryFileDownloadPath:tempFilePath]; self.request.showAccurateProgress = YES; self.request.delegate = self; [self.request startAsynchronous]; }