3
votes

I'm using QLPreviewController object in order to load documents in my app.

This is the code that loads the file:

fileURL = [NSURL fileURLWithPath:appFile];

QLPreviewController *previewController = [[QLPreviewController alloc] init];
previewController.dataSource = self;
previewController.delegate = self;



previewController.currentPreviewItemIndex = 0;

previewController.view.frame = CGRectMake(0, 26, self.view.frame.size.width, self.view.frame.size.height - 26);

lblTitle.text = [appFile lastPathComponent];

[self.view addSubview:previewController.view];

Works fine, the docs are loaded.

The problem is when I try to load a document larger than 10 MB. In example a Powerpoint doc with 12 slides with images.

I've used instruments and according with allocations tool the app grows till > 20 MB and crashes.

Anyone knows the better way to load documents in QLPreviewController or other class?

Thanks.

1

1 Answers

0
votes

You either write your own preview controller that can work more efficiently than Apple's (ha! Possible, but not likely), or you optimize your document and make it smaller (lower res images, less complex backgrounds, etc). I would go for option B. Are you trying to load it in an iPad 1, by chance? I've found that iPad 2 and the third generation iPad can handle some pretty large documents.