transitionContext viewForKey: always returns nil for presenting view during modal transition

Number:rdar://17961976 Date Originated:8/8/2014
Status:Open Resolved:
Product:iOS Product Version:iOS 8 Beta 5
Classification: Reproducible:
In iOS8 Beta 5, the `viewForKey:` method of UIViewControllerContextTransitioning always returns nil for the presenting view controller's view. In a presentation action, this means that it returns nil when called with `UITransitionContextFromViewKey`. In a dismissal, the `UITransitionContextToViewKey` is nil instead.  This makes it impossible to create modal animations that animate the presenting view (for instance by sliding down to reveal a view underneath, or by scaling down with a transform to provide a zoom-up effect when showing the modal, or recreating something similar the flip-horizontal or page-curl modal transitions).

In iOS7, you would instead use the `view` property of the respective view controllers, which continues to work correctly on iOS7 devices. If you try this on iOS8, the view hierarchy becomes broken following dismissal transitions.

Steps to Reproduce:
Using the attached sample project:

1. Build the project using Xcode 6 Beta 5 to an iPhone running iOS7.
2. Tap the present/dismiss buttons
3. Observe the working transition.

4. Build the project using Xcode 5 Beta 5 to an iPhone running iOS8 Beta 5.
5. Tap the present/dismiss buttons
6. Observe that the broken transition.

Expected Results:
The iOS8 device should maintain the slide transition effect that this transition provides on iOS7.

The original controller slides off, as a new controller underneath fades in. On dismissal, the animation reverses.

Actual Results:
On iOS8, the original controller disappears immediately, and the new controller fades in. The slide transition does not occur.

iOS 8 Beta 5, Xcode 6 Beta 5

Sample project also available on GitHub:

iPhone 5S 16GB A1533. Also iPhone Simulator.


Xcode beta 7

I was reproducing this too, but just tried in the Xcode Beta 7 and transitionContext.viewForKey(UITransitionContextFromViewKey)! returned my view :)

By permakittens at Sept. 6, 2014, 2:53 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!