比如
#import "Masonry.h"
上面这样是可以的,没有问题
#import <Masonry/Masonry.h>
这样就不行了,提示找不到文件
曾经蜡笔没有小新2017-05-02 09:29:12
#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
phpcn_u15822017-05-02 09:29:12
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;