UIActivityViewController ipad崩溃
2019-03-28 本文已影响0人
__May__
UIActivityViewController在iphone上直接使用如下代码就OK
UIActivityViewController *activityController =
[[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityController animated:YES completion:nil];
在ipad上必须通过popoverPresentationController才能弹出UIActivityViewController
解决办法是 在 presentController 前面加一句
if ([activityViewController respondsToSelector:@selector(popoverPresentationController)]) { activityViewController.popoverPresentationController.sourceView = self.view; }