ios - 无法呈现文档交互 Controller

标签 ios objective-c uidocumentinteraction

我最近提交了一个应用程序,但由于问题被拒绝了:

the share button does not function, when a user presses it no action occurs

在我将它提交到应用商店之前,它一直在工作。但现在不是了。

我无法显示文档交互 Controller 。

这是我之前的工作:

 UIAlertAction* share = [UIAlertAction
                             actionWithTitle:@"Share"
                             style:UIAlertActionStyleDefault
                             handler:^(UIAlertAction * action)
                             {
                                 [self shareImage];
                                 [alert dismissViewControllerAnimated:YES completion:nil];

                             }];

执行此操作后,我收到警告:

_bsmacherror (os/kern) invalid capability (20)
_bsmacherror (os/kern) invalid name (15)

然后我将 shareImage 代码放在主线程上:

     dispatch_async(dispatch_get_main_queue(), ^{
                  [self shareImage];
     });

警告消失了......但是还是打不开document interac controller

打开doc interac Controller 的代码是:

-(void)shareImage{

    UIButton *button = (UIButton *)nil;
    NSURL *URL = [NSURL fileURLWithPath:_savedImagePath];

    if (URL) {
        // Initialize Document Interaction Controller
        self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];

        // Configure Document Interaction Controller
        [self.documentInteractionController setDelegate:self];

        // Present Open In Menu
        [self.documentInteractionController presentOpenInMenuFromRect:[button frame] inView:self.view animated:YES];
    }

}

我设置了 UIDocumentInteractionControllerDelegate 并检查了图像是否存在于 _savedImagePath 中。

doc interac Controller 有错误处理方法吗?

我该如何解决这个问题?

最佳答案

您的问题似乎是由于 buttonnil 并试图从 nil 按钮的框架中呈现 Controller 。这为您提供了一个 CGRectZero 框架。你为什么要这样做?

从有效框架或 UIBarButtonItem 显示 Controller 。

关于ios - 无法呈现文档交互 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33695697/

相关文章:

objective-c - 从应用程序内将捆绑的 PDF 发送到 iBooks

ios - UIDocumentInteractionController 不工作

ios - 将 UIView 的 UILabel 居中

ios - IPv6 - Apple 拒绝 iOS 应用程序,因为不支持 IPv6 DNS64/NAT64 网络

ios - 在 tableView 的文档目录中存储和检索图像?

ios - 发现 UIActivityViewController 支持的所有端点,如微信、KaKao、Line 等?

objective-c - ARC 引入了哪些新的类型限定符?

ios - Xcode 错误 : Auto property synthesis is synthesizing property not explicitly synthesized

ios - 我怎样才能像在谷歌地图中那样缩放

ios - 启动没有 UI 的 iOS 扩展