我创建了一个csv文件并尝试通过电子邮件发送它.显示发送邮件的窗口,但不填充电子邮件正文,也没有附加文件.应用程序挂起此屏幕:
按钮"取消"不起作用.在控制台中出现几秒钟后:
viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=0x7f8409f29b50 {Message=Service Connection Interrupted}
<MFMailComposeRemoteViewController: 0x7f8409c89470> timed out waiting for fence barrier from com.apple.MailCompositionService
Run Code Online (Sandbox Code Playgroud)
有我的代码:
func actionSheet(actionSheet: UIActionSheet!, clickedButtonAtIndex buttonIndex: Int) {
if buttonIndex == 0 {
println("Export!")
var csvString = NSMutableString()
csvString.appendString("Date;Time;Systolic;Diastolic;Pulse")
for tempValue in results { //result define outside this function
var tempDateTime = NSDate()
tempDateTime = tempValue.datePress
var dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
var tempDate = dateFormatter.stringFromDate(tempDateTime)
dateFormatter.dateFormat = "HH:mm:ss"
var tempTime …Run Code Online (Sandbox Code Playgroud) ios uidocumentinteraction mfmailcomposer uiactivityviewcontroller
我需要让我的应用程序打开来自Safari和Mail应用程序的文档,并在UIDocumentInteractionController课堂上打开"Open In ..." .我该如何做到这一点?
我用谷歌搜索,并得到一些解决方案,似乎唯一可行的方法是通过UIDocumentInteractionController.我找到了只能共享文本的结果,也找到了仅共享图像的结果.
但我要的是份额BOTH.
我知道这个问题可能会重复,我只想说清楚,这是截图...

(这是从Android共享的)
我在我的应用程序中实现了UIDocumentInteractionController,用于显示选项中的open.它在iOS8设备上运行良好,但在iOS7中我从邮件中打开我的PDF选项.当我关闭邮件编辑器时它会打开邮件编辑器,它也会从我的视图中删除一个菜单按钮(添加到窗口中).我花了一整天的时间来解决这个问题,但找不到任何解决方案.当我在其他选项中打开PDF时,没有问题.问题只出在邮件编辑器和iOS7上.我知道UIDocumentInterfaceController与iOS7有问题. 我在SO上发现了同样的问题,但这是一个快速查看的预览选项.
这是我打开选项的代码
[self.docInteractionController presentOptionsMenuFromRect:self.view.frame
inView:self.view
animated:YES];
Run Code Online (Sandbox Code Playgroud)
任何有关这方面的帮助将不胜感激.
提前致谢.
是否可以将图像添加到UIActionSheet所见的按钮UIDocumentInteractionController?如果是这样,请告诉我它是如何完成的.

iphone objective-c uiimage uiactionsheet uidocumentinteraction
我已经开始使用UIDocumentInteractionController为一个新的应用程序,但我想知道如何添加其他操作到您在预览屏幕上获得的操作菜单?
似乎菜单只列出已注册给定网址类型的应用程序,而且我看到PRINT出现在iOS4.2上.我想通过电子邮件添加发送并保存到照片,但没有看到扩展此菜单的方法.我可以编写我想要的动作,它只是将它们添加到菜单中似乎不可能吗?
我错过了一些明显的东西吗
我实现了一个UIDocumentInteractionController来将文件发送到其他应用程序.该文件是.txt文件.
这是代码:
UIDocumentInteractionController *interactionController = [[UIDocumentInteractionController alloc] init];
[interactionController setURL:[NSURL fileURLWithPath:filePath]];
[interactionController setUTI:@"public.text"];
[interactionController setDelegate:self];
[interactionController presentOpenInMenuFromBarButtonItem:actionBarButtonItem animated:YES];
Run Code Online (Sandbox Code Playgroud)
菜单打开正常,显示像Pages,Dropbox等应用程序,如我所料.但是当我点击其中一个时,Open In菜单会解除并且不执行任何操作(文件未发送且目标应用程序永远不会打开.
我尝试实现委托方法documentInteractionController:canPerformAction:和documentInteractionController:performAction:触发copy:和print:调用使用选项菜单(而不是菜单中的打开),并拉出一个只列出页面的菜单,但仍然无效.
怎么解决这个问题?
我正在尝试使用UIDocumentInteractionController预览文档.该文档是我的应用程序从网上下载的.xls文件.我一直收到这个错误:
'UIDocumentInteractionController: invalid scheme (null). Only the file scheme is supported.'
Run Code Online (Sandbox Code Playgroud)
我用下一个代码:
- (void) webServiceController:(WebServiceController *)webServiceController returnedArray:(NSMutableArray *)array {
if ([webServiceController.webRequest isEqualToString: @"generateExcelFileForEmployee"]) {
// start previewing the document at the current section index
NSString *link = [[NSString stringWithString:array[0]] stringByReplacingOccurrencesOfString:@"AdminFunctions.php" withString:@"AdminFunctions.xls"];
link = [[[link stringByReplacingOccurrencesOfString:@"\\" withString:@""]stringByReplacingOccurrencesOfString:@"/public/sites/" withString:@"http://"]stringByReplacingOccurrencesOfString:@"\"\\\"" withString:@""];
NSLog(@"%@", link);
NSData *urlData = [NSData dataWithContentsOfURL:[NSURL URLWithString:link]];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory,@"AdminFunctions.xls"];
BOOL isWriteSuccess = [urlData writeToFile:filePath atomically:YES];
NSLog(@"%@", …Run Code Online (Sandbox Code Playgroud) 我UIDocumentInteractionController用来显示PDF文件.我的文件使用非用户友好的编码文件名存储在文件系统中.我有权访问该文件的更友好的名称,但该文件未存储此名称(出于唯一性原因).
当我将文档加载到UIDocumentInteractionController视图中时,视图会在标题栏中显示不友好的"真实"文件名.
有没有办法改变显示的标题UIDocumentInteractionController?
由于新的SDK是释放(iOS 6中),委托方法documentInteractionController:canPerformAction:的UIDocumentInteractionControllerDelegate已弃用.
使用该方法,你能阻止默认操作,如print:和copy:出现.
该方法在当前版本的iOS 6中调用,但在将来的版本中,此方法将不会被调用,我的应用程序将显示我不想支持的操作.
我阅读了UIDocumentInteractionController及其委托的可用文档,我无法找到另一种方法来执行我在canPerformAction方法中所做的工作.
有任何想法吗?
作为一个加号,能够过滤邮件或推特等应用程序(默认情况下显示)会很棒,但我想这是不可能的.