我正在尝试从服务器下载一些内容,一切正常,但文件未写入文档文件夹。目前我在模拟器上测试它。
调用所有委托函数。但文件未写入文件夹
请告诉我代码中的问题
- (void)downloadContentsFromServer:(NSMutableArray*)aPoemDownloadContentURLs
{
if(!self.networkQueue)
self.networkQueue = [[[ASINetworkQueue alloc] init] autorelease];
[self.networkQueue cancelAllOperations];
[self.networkQueue setDelegate:self];
for(NSString* urlString in aPoemDownloadContentURLs)
{
NSString *Filename = [urlString lastPathComponent];
NSURL *url = [NSURL URLWithString:urlString];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
NSLog(@"file name here %@ ", Filename);
[request setDownloadDestinationPath:[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:Filename]];
[request setShouldContinueWhenAppEntersBackground:YES];
[request setDelegate:self];
[request setDidFinishSelector:@selector(requestDone:)];
[request setDidFailSelector:@selector(requestWentWrong:)];
[request setNumberOfTimesToRetryOnTimeout:3];
[self.networkQueue addOperation:request];
}
[self.networkQueue go];
}