相关疑难解决方法(0)

NSURLConnection下载大文件(> 40MB)

我需要从服务器下载大文件(即> 40MB)到我的应用程序,这个文件将是ZIP或PDF.我使用NSURLConnection实现了它,如果文件较小,则可以正常工作,因为它下载了部分填充并且执行已经停止.例如我试图下载36MB PDF文件,但只下载了16MB.请帮我知道原因?怎么解决?

仅供参考:实施档案

#import "ZipHandlerV1ViewController.h"
@implementation ZipHandlerV1ViewController
- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}
 - (void)viewDidLoad
 {
     UIView *mainView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 400, 400)];
     [mainView setBackgroundColor:[UIColor darkGrayColor]];

     UIButton *downloadButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
     [downloadButton setFrame:CGRectMake(50, 50, 150, 50)];
     [downloadButton setTitle:@"Download File" forState:UIControlStateNormal];
     [downloadButton addTarget:self action:@selector(downloadFileFromURL:) forControlEvents:UIControlEventTouchUpInside];
     [mainView addSubview:downloadButton];

     [self setRequestURL:@"http://www.mobileveda.com/r_d/mcps/optimized_av_allpdf.pdf"];
     [self.view addSubview:mainView];

     [super viewDidLoad];
 }

- (void)viewDidUnload
{
    [super viewDidUnload];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}


-(void) setRequestURL:(NSString*) …
Run Code Online (Sandbox Code Playgroud)

iphone file download ios

17
推荐指数
3
解决办法
2万
查看次数

标签 统计

download ×1

file ×1

ios ×1

iphone ×1