File not found when importing third-party library imported via cocoapods
PHP中文网
PHP中文网 2017-05-02 09:27:12
0
3
817

For example

#import "Masonry.h"

The above is okay, no problem

#import <Masonry/Masonry.h>

This doesn’t work, it says the file cannot be found

PHP中文网
PHP中文网

认证0级讲师

reply all(3)
曾经蜡笔没有小新

#import <Masonry/Masonry.h>This form will search for the path in the header path setting of your build setting. Of course, if you do not configure the header search path, the file will not be found.

Why can #import "Masonry.h" be found?
The reason is that Xcode will include all header files by default, so #import "Masonry.h" is OK.

In what circumstances is this form of #import <Masonry/Masonry.h> used?
If your project has multiple targets, configure the header search path and use the form #import <Masonry/Masonry.h>, otherwise header file conflicts will be very annoying.

Supplementary (the following pictures will make it easier to understand)
build settings configuration

Directory structure

Header file import

滿天的星座

Does Masonry have a static library? You quoted it like this

phpcn_u1582

There is a bug in Xcode: Even if the header file cannot be found when writing code, it can be built.
Also, if you use a framework, you can use @import Masonry;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template