Xcode 6.4: IB Designables error when defining custom view in both framework and library target
| Originator: | bugreportopenradar | ||
| Number: | rdar://22135878 | Date Originated: | August 4, 2015 |
| Status: | Duplicate/Open | Resolved: | |
| Product: | Xcode | Product Version: | Xcode 6.4 (6E35b) |
| Classification: | Serious bug | Reproducible: | Sometimes |
Summary: When a custom IB_DESIGNABLE UI component is defined in both a framework target and a static library target, Xcode sometimes raises errors because it fails to load the designables. The attached project demonstrates the issue. Steps to Reproduce: 1. Create new iOS Framework project (“CustomUIComponents”) 2. Create new subclass of UIButton in that project (“MyCustomButton”). Mark it as “IB_DESIGNABLE” in its header, and override prepareForInterfaceBuilder and initWithCoder:... and set the background color of the button in both methods. 3. Create new iOS App project (“IBDesignablesIssue”) 4. Add CustomUIComponents as a subproject to IBDesignablesIssue 5. Add CustomUIComponents framework to “Embedded Binaries” and “Linked Frameworks and Libraries” of the IBDesignablesIssue target 6. Open the Main.storyboard and add a button. Set the class of the button to MyCustomButton. Notice that Xcode compiles for Interface Builder and the button shows the background color that you set in step 2. 7. Add a new static library target to CustomUIComponents project (“CustomUIComponentsLib”) 8. Add MyCustomButton to that new target CustomUIComponentsLib 9. Quit Xcode 10. Delete ~/Library/Developer/Xcode/DerivedData 11. Open the IBDesignablesIssue project again, and then Main.storyboard Expected Results: Nothing should have changed compared to the result of step (6). In other words, no errors should be raised and the button should still render with the customizations of step (2). Actual Results: When opening the storyboard, Xcode not only compiles the CustomUIComponents framework target (expected), but also the CustomUIComponentsLib static library target (unexpected). Furthermore, the order in which the two are compiled varies. Whenever the static library target is compiled before the framework target, Xcode gives the following errors: IB Designables - Failed to update layout status: Failed to load designables from path (null) IB Designables - Failed to render instance of MyCustomButton: Failed to load designable from path (null)
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!
Duplicate
This bug is a duplicate of rdar://18266957.