UIActivity ActivityViewController will not dissolve on the iPad

I have a UIActivity subclass, which 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;
}

I added a complete repro on GitHub.

According to the documentation, you should not manually dismiss. Instead, the operating system will do this when you call activityDidFinish: this works fine when running on the iPhone.

When I say “work”, this is The sequence of events I am looking forward to (and see on the iPhone):

>Show UIActivityViewController
>User presses my custom activity
>My view controller appears
> I called activityDidFinish:
>My custom view controller was closed
> UIActivityViewController was also dismissed

However, when I run the same code on the iPad simulator-only The difference is that I put the UIActivityViewController in the popup window, as the documentation says-activityViewController will never dissolve.

As I said, this is the code wo/popUP works on the iPhone, I have Complete the code step by step, so I know activityDidFinish: is being called.

I found this radar talked about the same problem in iO S6 beta 3, but it seems to be such a basic function, I suspect a bug in my code rather than the operating system (also note that it works properly with Twitter and Facebook functions! ).

Am I missing something? When it runs in UIPopoverViewController, do I need to do something special in activityViewController? Should the “traffic” on the iPad be different?

Auto-dismiss will only appear when your “activity” controller is directly rendered, not Included in any content. So before displaying the pop-up window it contains, add a completion handler

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

You will be fine.

I have A UIActivity subclass, which 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;
}

I added a complete repro on GitHub.

According to the documentation, you should not be fired manually. Instead, operate The system will do this when you call activityDidFinish: this works fine when running on the iPhone.

When I say “work”, this is the sequence of events I expect (and see on the iPhone) :

>Show UIActivityViewController
>User presses my custom activity
>My view controller appears
>I call activityDidFinish:
>Me
> UIActivityViewController is also dismissed

However, when I run the same code on the iPad simulator-the only difference is that I put the UIActivityViewController in the popup , As the documentation says-activityViewController will never be disbanded.

As I said, this is the code wo/popUP works on the iPhone, I have gradually completed the code, so I know that activityDidFinish: is being Call.

I found this radar talked about the same problem in iOS6 beta 3, but it seems to be such a basic function, I suspect a bug in my code rather than the operating system (Also note that it works properly with Twitter and Facebook functions! ).

Am I missing something? When it runs in UIPopoverViewController, do I need to do something special in activityViewController? Should the “traffic” on the iPad be different?

The automatic dismissal will only appear when your “activity” controller is directly rendered, and will not be included in any content. So when displaying it contains Before the pop-up window, add a completion handler

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

You will be fine.

Leave a Comment

Your email address will not be published.