iPhone应用程序在QLPreviewController ios 4.2中点击菜单操作按钮时崩溃
When I try to click the menu action button in QLPreviewController the application crashes.
这就是我在委托方法中所做的事情
This is what I'm doing in delegate method
- (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.'
当我尝试预览文件时,本地菜单操作按钮点击不会崩溃。
When I try to preview file present locally menu action button click is not crashing.
我将使用
NSURL *fileURL;
fileURL = [NSURL fileURLWithPath:filePath];// filePath is local file path.
据我所知,当我们预览本地文件([NSURL fileURLWithPath:filePath])时,菜单操作按钮点击是没有崩溃,当我们从服务器预览文件时([NSURL URLWithString:Url])菜单操作按钮点击崩溃。
I understood that when we preview local files ([NSURL fileURLWithPath:filePath]) menu action button click is not crashing ,, when we preview files from server ([NSURL URLWithString:Url]) menu action button click crashes.
我有两个问题,
1。我们可以禁用菜单操作按钮吗?
2.有没有办法使用[NSURL URLWithString:Url]来避免崩溃?
I have two questions, 1. Can we disable the menu action button? 2. Is there any way to avoid the crash using [NSURL URLWithString:Url]?
谢谢
需要使用
[NSURL fileURLWithPath:urPath]