UIKeyCommand selector call retains viewController
| Originator: | johnmarshall4 | ||
| Number: | rdar://22860430 | Date Originated: | 9/25/2015 |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | 9.0 |
| Classification: | Bug | Reproducible: | Yes |
Summary: In iOS 9, if a UIKeyCommand selector method is called on a viewController, that controller is retained and will not dealloc when dismissed causing memory leaks. Steps to Reproduce: 1. Implement a project with two view controllers - one dynamically created / dismissed. 2. Implement a keyCommands property on the 2nd view controller registering a key and a selector (with some NSLog trace) in the 2nd view controller. 3. Make sure the 2nd view controller becomes first responder when it is shown. 4. Implement dealloc in the 2nd view controller with NSLog trace 5. Run the app 6. Preset the second view controller. 7. Press the registered key on the external keyboard and verify that the selector gets called. 8. Dismiss the 2nd view controller. Results: the 2nd view controllers dealloc will not get called. Expected Results: Expected that handling UIKeyCommands in a view controller will not cause it to leak. i.e. keep dealloc from getting called Actual Results: After a UIKeyCommand selector is called in a view controller, that view controller will not dealloc when dismissed Version: iOS 9.0 (13A340)
Comments
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!
Still exists in iOS 9.2
This bug still reproduces as of iOS 9.2.