I have an existing framework (MyFramework) and I've added a new class to it, NewClass. In another project I am already using this framework and I now want to use NewClass as well. I use the following import statements:
#import <MyFramework/OldClass.h>
#import <MyFramework/NewClass.h>
When I compile the project, I get an error on the second import that says "MyFramework/NewClass.h: No such file or directory". NewClass.h is in the exact same location as OldClass.h, the framework compiles with no errors,开发者_开发知识库 I've made sure to clean out any old artifacts, and I've verified that in the framework's target I've included NewClass.h in the "Copy Headers" build phase.
What additional step is required to make a framework's header files available to users of the framework?
p.s. I realize that I should likely have a single MyFramework.h for anyone wanting to use the framework, but I'll tackle that once I've figured out how to add new headers!
Set role of the header to Public.
In Xcode 3 right click on the header, select Set Role from the menu.
In Xcode 4 select your target, open Build Phases and change the section of your header in the Copy Headers section from Project to Public.
Update: In Xcode 4.5 select the header, open the File Inspector in the Utilities panel on the right, change the role to Public in the Target Membership section.
精彩评论