Swift Failable and throwing initializers for Foundation and UIKit classes causes error
| Originator: | meteochu | ||
| Number: | rdar://24382920 | Date Originated: | January 27, 2016 |
| Status: | Duplicate of 25023544 | Resolved: | |
| Product: | Developer Tools (Swift) | Product Version: | |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: Creating convenience initializers (failable OR throwing) for Foundation and UIKit classes can cause EXC_BAD_ACCESS when the initializer throws OR `return nil`. This behaviour only occurs for Foundation and UIKit classes. Foundation/UIKit subclasses work and behave as normal. Steps to Reproduce: 1. Create a Foundation/UIKit class extension (eg. NSObject or UIColor) 2. Add a convenience failable initializer 3. Create the object through the convenience initializer with the condition that will fail 4. EXC_BAD_ACCESS happens when the object is initialized (Same steps with throwing initializer) Expected Results: `nil` should be the result of the failed (or error thrown) initialization. Actual Results: Execution was interrupted; reason: EXC_BAD_ACCESS Version: Xcode 7.3 beta 2 (7D129n) OS X 10.11.4 Beta (15E33e)
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!