ASIHTTPRequest下载的文件未被写入

时间:2012-07-09 11:57:59

标签: iphone ios ios4 asihttprequest

我正在尝试从服务器下载一些内容,一切正常,但文件未写入文档文件夹。目前我在模拟器上测试它。

调用所有委托函数。但文件未写入文件夹

请告诉我代码中的问题

- (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];
}

0 个答案:

没有答案