Xcode can't find header file

前端 未结 2 1865
无人共我
无人共我 2021-02-04 02:51

I am trying to make a framework for my project. Into my framework I added the path of my header files to target>Build Settings>header-search path. After that I added th

相关标签:
2条回答
  • 2021-02-04 03:18

    Everything look normal but i cannot add headers to my project which i included to my framework with header search path.

    It sounds as though you're expecting all the headers that can be found at the path specified by your header search path will become part of your framework, so that if there's a header named SomeHeader.h in your search path, it will be built into your framework and you'll be able to import it into client projects like:

    #import <MyFramework/SomeHeader.h>
    

    But that's not the case at all. If you want your framework to provide SomeHeader.h, you need to add that file to the project and, as Meghs Dhameliya already pointed out, you need to specify SomeHeader.h in the Public Headers portion of the Headers build phase. This will make Xcode copy the header file into the framework so that clients of the framework can import the header file. It's not clear that that's what you really want, though... in comments you wrote:

    There is a lot of headers in another path. I have to use header search path unfortunately. Kind of company rule.

    So it sounds like all projects in your company specify the same header search path so that they have access to these header files. If that's true, then there's no reason for projects to need to #import them from your framework, but in that case it's not clear what the actual problem is. Or, perhaps you're creating the framework so that client projects can get the headers from your framework instead of having to reference the header search path. In that case, you will need to add those headers to the project and specify them as described above.

    0 讨论(0)
  • 2021-02-04 03:19

    Make sure you all Public Header appears in Public Section else drag and drop .h file to public

    0 讨论(0)
提交回复
热议问题