문제

Can't I leave out #import "foo.h" in .m file if it's already in the prefix header?

The product still builds successfully when I leave it out. But, I've noticed that the Xcode templates keep them in. Why?

Is the answer the same for #include?

도움이 되었습니까?

해결책

I don't know why it does this, but it doesn't hurt because #import protects from double #include by checking if something is already #import-ed or #include-d, so no, the same scenario wouldn't work with #include.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top