尝试预览大文件时QLPreviewController崩溃 [英] QLPreviewController crashes when trying to preview big files

查看:144
本文介绍了尝试预览大文件时QLPreviewController崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里想要实现的是,我有一个Adobe Flex应用程序,它有一个原生扩展,这里是我用来在QLPreviewController中打开文件的本机代码。问题是这适用于小文件大约<1M。但是对于更大的文件,QLPreviewController启动然后崩溃。好吧有时它工作几秒然后崩溃,或者有时甚至工作正常但是当我通过按下它关闭它时,应用程序本身崩溃。

What I'm trying to achieve here is, I have a Adobe flex app which has a native extension and here is the native code which I use to open the file in QLPreviewController. The problem is this works great with small files approx <1M. But with bigger files the QLPreviewController launches and then crashes. Well sometimes it works for few seconds and then crashes, or sometimes even works fine but when I close it by pressing done the App itself crashes.

该代码适用于较小尺寸的文件,并且没有任何问题多次打开和关闭这些文件。我注意到的另一件事是ios 4不会发生问题。它也可以打开大文件。但是一旦我升级到5. 这个问题就开始发生了。

The code works fine for file of smaller sizes and does not have any issues opening and closing those files multiple times. One more thing that I noted is the issues does not happen with ios 4.. its able to open big files too. But once I upgraded to 5.. this issues started happening.

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

// start previewing the document at the current section index
previewController.currentPreviewItemIndex = 0;
//[[self navigationController] pushViewController:previewController animated:YES];

[[[[UIApplication sharedApplication] keyWindow] rootViewController] 
presentModalViewController:previewController animated:YES];

[previewController release];

任何帮助/意见/建议表示赞赏。在此先感谢。

Any help/comments/suggestions are appreciated. Thanks in advance.

推荐答案

您的数据源是如何获取预览数据的?我的猜测是你正在将一个非常大的图像加载到内存中并快速耗尽它。将文件保留到文件系统并将dataSource指向该文件。

What is your dataSource doing to get the data for the preview? My guess is you are loading a very large image into memory and quickly running out of it. Persist the file to the file system and point the dataSource to the file.

这篇关于尝试预览大文件时QLPreviewController崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆