Xcode-Beta (6D520o)/Swift: UIControl.addTarget(action:forControlEvents) accepts a private action method but crashes at runtime with unrecognized selector
| Originator: | andrew | ||
| Number: | rdar://19886763 | Date Originated: | 19-Feb-2015 10:32 AM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-Beta (6D520o) |
| Classification: | Other Bug | Reproducible: | Always |
Summary: When adding a target to a UIControl object via addTarget(action:forControlEvents), it accepts a private method as the action parameter, but then crashes at runtime with an unrecognized selector. Steps to Reproduce: 1. Write a private function 2. Add it as a target of a UIControl object 3. Trigger the appropriate control event 4. Observe unrecognized selector crash Expected Results: The code should either not compile OR compile with a warning OR it should be possible to use a private method, so you don’t have to expose what might be an internal implementation detail. Actual Results: No compilation warning and a runtime crash. This is a missed opportunity for the Swift language to catch a potential bug earlier in the development cycle. Regression: N/A Notes: N/A
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!