点击分享按钮后,我用来向用户呈现操作的代码如下:
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
if ( [activityVC respondsToSelector:@selector(popoverPresentationController)] ) {
// iOS8
[activityVC.popoverPresentationController setPermittedArrowDirections:UIPopoverArrowDirectionRight];
activityVC.popoverPresentationController.sourceView = [self.myUiBarButtonItem valueForKey:@"view"];
}
[self presentViewController:activityVC animated:TRUE completion:nil];
共享文件过去有效,但现在在向 Microsoft Teams 发送 pdf 内容时在 iPad 上已停止工作。不过,我在 iPhone 上得到了预期的行为。
两台设备的IOS版本都是16.4.1
两个设备上的文件大小相同,所以很奇怪为什么这只在其中一个设备上失败。
我知道 iPad 上的 popover presentation controller 不能为 nil,我已经证实情况并非如此。
我尝试向我的 UIActivityViewController 添加一个完成处理程序,但这没有返回任何错误。
tl;博士: 适用于 iPhone,不适用于 iPad 文件大小相同 我没有收到活动控制器返回的错误 将 pdf 发送到 Microsoft Teams 时出现上述错误
我尝试将 pdf 文件放入捆绑包中,因为我认为它可能与内存有关(已损坏)。
我尝试在 didFinishNavigation 被调用时保存文件,然后在共享按钮被点击时加载它,因为我认为它可能与完成和/或异步问题(Busted)有关。
我尝试设置模态呈现样式并设置首选内容大小(不是问题)。
我尝试将我的网址作为数据发送。
我尝试改用 UIDocumentInteractionController,同样的错误。