iPhone应用程序在QLPreviewController ios 4.2中点击菜单操作按钮时崩溃 [英] iPhone- application crashes on click of menu action button in QLPreviewController ios 4.2

查看:393
本文介绍了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]

这篇关于iPhone应用程序在QLPreviewController ios 4.2中点击菜单操作按钮时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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