UIActivity activityViewController不会在iPad上解散 [英] UIActivity activityViewController not dismissing on iPad

查看:155
本文介绍了UIActivity activityViewController不会在iPad上解散的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UIActivity 子类,它创建了自己的 activityViewController

I have a UIActivity subclass that creates its own activityViewController:

- (UIViewController *)activityViewController {
    WSLInProgressViewController* progressView = [[[WSLInProgressViewController alloc] init] autorelease];
    progressView.message = [NSString stringWithFormat:NSLocalizedString(@"Posting to %@...",@"Posting to..."),
                        self.activityType];

    return progressView;
}

我添加了一个完整的重新登录GitHub

根据文档,你不是'我应该手动解雇这个。相反,操作系统会在您调用 activityDidFinish:时执行此操作。这在iPhone上运行时效果很好。

According to the documentation, you aren't supposed to dismiss this manually. Instead, the OS does that when you call activityDidFinish:. This works fine when ran on an iPhone.

当我说工作时,这是我期待的事件序列(并在iPhone上看到):

When I say "works," this is the sequence of events that I'm expecting (and see on the iPhone):


  1. 显示 UIActivityViewController

  2. 用户按我的自定义活动

  3. 我的视图控制器出现

  4. 我打电话给 activityDidFinish:

  5. 我的自定义视图控制器被解除

  6. UIActivityViewController 也被解雇

  1. Display the UIActivityViewController
  2. User presses my custom activity
  3. My view controller appears
  4. I call activityDidFinish:
  5. My custom view controller is dismissed
  6. The UIActivityViewController is also dismissed

然而,当我在iPad模拟器上运行相同的代码时 - 唯一的区别是我把 UIActivityViewController 在弹出窗口中,正如文档所说 - activityViewController 永远不会解散。

However, when I run this same code on the iPad Simulator -- the only difference being that I put the UIActivityViewController in a popup, as the documentation says you should -- the activityViewController never dismisses.

正如我所说,这是代码wo / popUP 在iPhone上工作,我已经完成了代码,所以我知道 activityDidFinish:正在调用。

As I say, this is code wo/the popUP works on the iPhone and I have stepped through the code so I know that activityDidFinish: is getting called.

我发现了他的雷达谈论 iOS6 beta 3 中的同样问题,但似乎这个基本功能,我怀疑我的代码而不是操作系统中的错误(也注意它与Twitter和Facebook功能正常工作!)。

I found this Radar talking about the same problem in iOS6 beta 3, but it seems such fundamental functionality that I suspect a bug in my code rather than OS (also note that it works correctly with the Twitter and Facebook functionality!).

我错过了什么吗?当它在 UIPopoverViewController 中运行时,我是否需要在activityViewController中做一些特殊的事情? iPad上的流假设是不同的吗?

Am I missing something? Do I need to do something special in the activityViewController when it's run in a UIPopoverViewController? Is the "flow" supposed to be different on the iPad?

推荐答案

只会出现自动解雇当你的'活动'控制器被直接呈现而不包含在任何东西中时发生。所以在显示弹出窗口之前,添加一个完成处理程序

The automatic dismissal only appears to happen when your 'activity' controller is directly presented, not wrapped in anything. So just before showing the popup it's wrapped in, add a completion handler

activity.completionHandler = ^(NSString *activityType, BOOL completed){
   [self.popup dismissPopoverAnimated:YES];
};

你会很好。

这篇关于UIActivity activityViewController不会在iPad上解散的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆