UIDocumentInteractionController不显示邮件选项 [英] UIDocumentInteractionController Does Not Show Mail Option

查看:156
本文介绍了UIDocumentInteractionController不显示邮件选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自我的应用程序的UIDocuemtnInteractionController(不显示邮件选项)

Heres the UIDocuemtnInteractionController from my application(does not show mail option)

这里Apples示例项目使用的是

Here the one that Apples sample project uses

以下是各自的代码

我的申请

docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
[docInteractionController presentOpenInMenuFromBarButtonItem:(UIBarButtonItem*)sender animated:YES];

Apple Sample Project

Apple Sample Project

NSURL *fileURL;
if (cellIndexPath.section == 0)
{
    // for section 0, we preview the docs built into our app
    fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:documents[cellIndexPath.row] ofType:nil]];
}
else
{
    // for secton 1, we preview the docs found in the Documents folder
    fileURL = [self.documentURLs objectAtIndex:cellIndexPath.row];
}
self.docInteractionController.URL = fileURL;

[self.docInteractionController presentOptionsMenuFromRect:longPressGesture.view.frame
                                                   inView:longPressGesture.view
                                                 animated:YES];

我应该做什么来获取邮件选项?

WHAT SHOULD I DO TO GET THE MAIL OPTION?

推荐答案

要提供邮件选项, -presentOpenInMenuFromBarButtonItem:需要要 -presentOptionsMenuFromRect:

根据 上的Apple文档> UIDocumentInteractionController

对于 -presentOpenInMenuFromBarButtonItem:animated:它说:


此方法类似于
presentOptionsMenuFromBarButtonItem:animated: 方法,但会显示
菜单限制到能够打开当前
文档的应用列表。此确定基于文档类型(由UTI属性指示
)和
支持的文档类型安装的应用程序。

...

如果没有支持打开文档的注册应用程序,
文档交互控制器不会显示菜单。

This method is similar to the presentOptionsMenuFromBarButtonItem:animated: method, but presents a menu restricted to a list of apps capable of opening the current document. This determination is made based on the document type (as indicated by the UTI property) and on the document types supported by the installed apps.
...
If there are no registered apps that support opening the document, the document interaction controller does not display a menu.



< h2>所以:

So:


  1. 要显示打开文件的选项,请使用 -presentOpenInMenuFromBarButtonItem :

  2. 要提供适用于该文件的所有可能选项,请使用 -presentOptionsMenuFromBarButtonItem:或泛型 -presentOptionsMenuFromRect:

  1. To present options to open the file, use -presentOpenInMenuFromBarButtonItem:
  2. To present all possible options applicable on the file, use -presentOptionsMenuFromBarButtonItem: or the generic -presentOptionsMenuFromRect:






...对于任何文件,最好指定 UTI 类型:

docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
//[docInteractionController setDelegate:self];
[docInteractionController setUTI:@"public.data"];
[docInteractionController presentOptionsMenuFromBarButtonItem:(UIBarButtonItem*)sender 
                                                animated:YES];
//or a generic method
//[docInteractionController presentOptionsMenuFromRect:sender.frame
//                                            animated:YES];

这篇关于UIDocumentInteractionController不显示邮件选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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