我最近提交了一个应用程序,但由于问题被拒绝了:
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 有错误处理方法吗?
我该如何解决这个问题?
最佳答案
您的问题似乎是由于 button
为 nil
并试图从 nil
按钮的框架中呈现 Controller 。这为您提供了一个 CGRectZero
框架。你为什么要这样做?
从有效框架或 UIBarButtonItem
显示 Controller 。
关于ios - 无法呈现文档交互 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33695697/