Categories/Interfaces From Static Libs Not Autocom

2020-05-27 04:55发布

问题:

Thanks to this post and the now built-in static library template, I am able to put some of the pieces of my project elsewhere. Everything compiles with no warnings and runs fine. However, I used to get autocomplete for the categories in my import statement. This is no longer happening. How can I get autocomplete for categories in a static library?

回答1:

The problem is that XCode doesn't know where to look for your header files.

To fix this, do the following - In the "User Header Search Paths" of your app's target, point to the location of your category header. That tells XCode where to look for it, and autocomplete should work. In case of multiple targets, you could fix it for each target or at the project's settings.



回答2:

Take the info of your project's 'Target'

Go to 'Other Linker Flags' and add '-all_load'.

Hope this helps :)



回答3:

I think you can get it to reindex everything if you uncheck the "Indexing: Enable for all projects" box in the Code Sense section of XCode Preferences. After unchecking it, maybe quit XCode, reopen it, then recheck that option. According to the help, unchecking that option not only turns indexing off, but also discards the current index.