-[UIActivity activityDidFinish:] doesn't dismiss activityViewController on iPad

Number:rdar://12034500 Date Originated:Sun, 05 Aug 2012 10:43:13 GMT
Status:Open Resolved:
Product:iPad SDK Product Version:6.0 Beta 3
Classification:UI/Usability Reproducible:Always
Summary: When subclassing UIActivity, you have the option of returning an activityViewController. This view controller does not need to be presented, as it will be handled automatically by the system. Similarly, the documentation specifically says not to dismiss this view controller directly, and instead to call -[UIActivity activityDidFinish:] which will dismiss the view controller automatically. This works on the iPhone, but on an iPad the view controller is never dismissed, and the presentingViewController property is nil so there is no way to dismiss it programmatically.

Steps to Reproduce: Create a custom subclass of UIActivity, and return a UIViewController. Have a button on the view controller connected to a method that calls -[UIActivity activityDidFinish:].

Expected Results: The view controller is dismissed.

Actual Results: The view controller remains onscreen.

Regression: Only happens on the iPad. Everything works as expected on the iPhone and iPod Touch.

Notes: Attached is a sample application to demonstrate the problem. This sample app is also being used to demonstrate other bugs, so to test this particular bug, simply tap the action button at the bottom of the screen, tap the "Test Activity" icon, and then tap the "Finish Activity" button.



Here is a workaround: https://github.com/0xced/HockeySDK-iOS/commit/d52652f4d237f93b3b786f9ab2a890e0de04888a

TL;DR: Keep your activityViewController in an ivar and create it only once.

By cedric.luthi at Nov. 1, 2013, 10:36 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!