2

I'm driving a UIStoryboardSegue with a UIPercentDrivenInteractiveTransition that is based on a user gesture. If the gesture ends before it has reached a certain completion rate, the segue is canceled by calling cancelInteractiveTransition on the UIPercentDrivenInteractiveTransition. However, the presented view controller does not get deallocated, as it has a retain cycle with the UIStoryboardSegue, as depicted below.

I tested this with Apple's sample code on Custom View Controller Presentations and Transitions and got the same problem. The image below is actually from their own project. Simply download the project, run it, and begin a segue but cancel it before it has completed. Repeat this 50 times and the Debug Memory Graph will show 50 leaked view controllers.

Are we supposed to nullify the destination view controller manually when we want to cancel the segue, or is this a bug in iOS? (I am running iOS10 on an iPhone 7 Plus).

enter image description here

Here is what profiling through Instruments show:

enter image description here

Daniel Larsson
  • 6,278
  • 5
  • 44
  • 82

0 Answers0