网站不完全下载

时间:2013-06-02 16:02:16

标签: ios nsurlconnection downloading

当我使用以下代码下载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");
}

0 个答案:

没有答案