When I try to click the menu action button in QLPreviewController the application crashes.
这是我在委托的方法正在做iPhone-应用程序崩溃的iOS 4.2
- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex:(NSInteger)index
{
NSMutableString*Url = [[NSMutableString alloc] initWithFormat:@"http://10.30.24.21/Documents/abc.doc];
NSURL *fileURL;
fileURL = [NSURL URLWithString:Url];// the url of the file which is present in NAS device
[Url release];
return fileURL;
}
这是崩溃报告
2011-01-11 12:21:36.717 iLink[5548:207] *** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit_Sim/UIKit-1447.6.4/UIDocumentInteractionController.m:1060
2011-01-11 12:21:36.720 iLink[5548:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIDocumentInteractionController: invalid scheme https. Only the file scheme is supported.'
当我尝试预览文件目前在本地菜单操作按钮单击不会崩溃。
那里,我将使用
NSURL *fileURL;
fileURL = [NSURL fileURLWithPath:filePath];// filePath is local file path.
我明白,当我们预览本地文件([NSURL fileURLWithPath:文件路径])菜单操作按钮,点击也不会崩溃,,当我们预览从服务器文件([ NSURL URLWithString:Url])菜单操作按钮,点击崩溃。
我有两个问题, 1.我们可以禁用菜单操作按钮吗? 2.有什么办法可以避免使用[NSURL URLWithString:Url]的崩溃?
感谢
应用程序的目标是不要下载文件。它只是用于预览使用URL在NAS设备中存在的文件。 – 2011-01-11 10:09:42
如果不从服务器提取文件,则无法预览文件。至少不是如果你想使用UIDocumentInteractionController。控制器需要本地文件系统上的文件才能运行。 – 2011-01-11 10:13:58