下载大文件时如何避免ios中的低内存警告

时间:2014-12-29 06:30:51

标签: objective-c nsoperationqueue

在我的应用程序中,我从服务器下载PDF文件。文件'总大小约为4GB。要下载所有这些文件,我使用的是NSOperationalQueues。虽然下载文件应用程序提供低内存警告和应用程序崩溃。我该如何解决这个问题?

NSOperationQueue *taskQueue ;

    int random = arc4random() ;
        NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:random], @"currentOperationKey", file, @"file", nil] ;
        NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(synchronizeFileInThread:) object:params] ;
        [operation addObserver:self forKeyPath:@"isFinished" options:0 context:nil];

        [taskQueue addOperation:operation] ;

0 个答案:

没有答案