无法呈现文档交互控制器
Unable to present document interaction controller
我最近提交了一个应用程序,但由于问题被拒绝了:
the share button does not function, when a user presses it no action
occurs
在我将其提交到应用商店之前,它正在运行。但现在不是了。
我无法显示文档交互控制器。
这是我之前的工作:
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];
});
警告消失了......但是还是打不开文档interac controller
打开doc interac控制器的代码是:
-(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控制器有错误处理方法吗?
我该如何解决这个问题?
您的问题似乎是由于 button
是 nil
并试图从 nil
按钮的框架中显示控制器。这给你一个 CGRectZero
的框架。你为什么要这样做?
从有效帧或 UIBarButtonItem
.
显示控制器
我最近提交了一个应用程序,但由于问题被拒绝了:
the share button does not function, when a user presses it no action occurs
在我将其提交到应用商店之前,它正在运行。但现在不是了。
我无法显示文档交互控制器。
这是我之前的工作:
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];
});
警告消失了......但是还是打不开文档interac controller
打开doc interac控制器的代码是:
-(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控制器有错误处理方法吗?
我该如何解决这个问题?
您的问题似乎是由于 button
是 nil
并试图从 nil
按钮的框架中显示控制器。这给你一个 CGRectZero
的框架。你为什么要这样做?
从有效帧或 UIBarButtonItem
.