UIDocumentInteractionController - 在iOS8中不解散MailCompose

时间:2014-10-24 09:47:12

标签: ios8 app-store uidocumentinteraction mfmailcomposer

我有一个非常奇怪(和严重)的问题。

我的应用使用UIDocumentInteractionController来共享PDF文档。 当用户选择" Mail"在控制器弹出的选项中打开MailCompose窗口。 但是,此窗口中的“发送”或“取消”按钮都不会导致MailCompose窗口被解除,这意味着用户卡住并且必须终止应用程序。邮件确实会消失。

这里有一个问题: 这种情况仅发生在iOS8(目前为止发布的两个版本)中,并且仅发生在通过AppStore安装的应用上。那个完全相同版本的应用程序,当通过USB调试在我的设备上运行时工作正常。

这里有一些代码:

-(void)sharePDF:(id)sender
{
    @try
    {

        NSURL *fileURL = [NSURL fileURLWithPath:currentFileObject.LocalPath];

        if(fileURL)
        {
            //UIDocumentInteractionController

            NSString *newPath;
            @try
            {
                //Create a copy of the file for sharing with a friendly name
                if (currentFileObject.isSpecialReport)
                {
                    newPath = [svc saveReport:[NSData dataWithContentsOfURL:fileURL] ToFile:[NSString stringWithFormat:@"%@.pdf", currentFileObject.ReportName]];
                }
                else
                {
                    newPath = [svc saveReport:[NSData dataWithContentsOfURL:fileURL] ToFile:[NSString stringWithFormat:@"%@.pdf", currentFileObject.PatientFullName]];
                }

            }
            @catch (NSException *exception) {
                return;
            }
            NSURL *newURL = [NSURL fileURLWithPath:newPath];
            self.docController = [UIDocumentInteractionController interactionControllerWithURL:newURL];
            self.docController.delegate = self;
            if (currentFileObject.isSpecialReport)
            {
                self.docController.name = [NSString stringWithFormat:@"Pathology - %@", currentFileObject.ReportName];
            }
            else
            {
                self.docController.name = [NSString stringWithFormat:@"Pathology - %@", currentFileObject.PatientFullName];
            }


            [self.docController presentOptionsMenuFromBarButtonItem:btnShare animated:YES];
        }
    }
    @catch (NSException *exception) {
        return;
    }

}

我没有实现任何委托方法,因为不需要它们,我也没有使用预览功能。

对我来说最令人费解的是AppStore中的应用程序与我的本地应用程序的行为不同,尽管代码相同。我的下一步是使用新的beta开发人员工具(Test Flight)重新发布应用程序,希望我可以复制问题。

编辑:我在这里发现了一个类似的问题:Cannot dismiss email sheet invoked from UIDocumentInteractionController in iOS 8 阅读该帖后,我认为值得一提的是我通过XCode 5(XCode 6之前的最后一个版本)将应用程序提交到AppStore。这真的可以成为一个因素吗? Apple不会使用与最初构建应用程序版本相同的版本吗?

1 个答案:

答案 0 :(得分:1)

我认为这是iOS 8中的一个错误,如果它仍然不适合你,我不认为Apple可能会修复它。我升级到Xcode 6,看看是否能为您修复它。 (It did for us,正如您所发现的那样)。