0

当我使用以下代码下载 tagesanzeiger.ch 网站时,它并没有完全下载。只有大约四分之一的内容下载,但我收到“下载完成”消息,表明连接已完成加载。我需要更改的任何设置的任何想法?

       - (void)downloadWebsite
        {
        NSString *tagiString = @"http://tagesanzeiger.ch";
        NSURL *websiteURL = [NSURL URLWithString:tagiString];
        NSURLRequest *request = [NSURLRequest requestWithURL:websiteURL];
        connection = [[NSURLConnection alloc] initWithRequest:request
                                                     delegate:self
                                             startImmediately:YES];
        }

        - (void)connection:(NSURLConnection *)conn didReceiveData:(NSData *)data
        {
            [articleData appendData:data];
        }

        - (NSString *)data
        {    
        NSString *text = [[NSString alloc] initWithData:articleData
                                               encoding:NSSymbolStringEncoding];      
        return text;
        }

- (void)connectionDidFinishLoading:(NSURLConnection *)conn
{
     NSLog(@"Download completed");
}
4

0 回答 0