PresentViewController:动画未在 iPad 上显示

PresentViewController: animated not displaying on iPad

我正在将 TwitterSLService 集成到一个应用程序中。它在 iPhone 上运行良好,但在 iPad 上消失了。

我已经在iPad上集成了:

  [actionSheet showFromRect:self.myRect inView:self.tableView animated:YES];

而不是:

 [actionSheet showInView:[UIApplication sharedApplication].keyWindow];

是否有类似的方法来代替 iPad 来代替 presentViewContoller: Animated:

    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController
                                               composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:self.textForTweet];

        [self presentViewController:tweetSheet animated:YES completion:nil];
    } else [self displayAlertBoxWithTitle:@"Tweet Failed" message:@"Please try again later" cancelButton:@"Close"];
}

我应该改用模态对话框吗?

起初我错过了这条错误信息:

Warning: Attempt to present <SLComposeViewController: 0x175d6560>  on <ScheduleTableViewController: 0x17538c20> which is already presenting (null)

这让我在不同的上下文中讨论相同的问题here

通过建议的解决方法解决了问题:

dispatch_async(dispatch_get_main_queue(), ^ {
            [self presentViewController:tweetSheet animated:YES completion:nil];
        });