문제

.pch 파일의 중요성은 무엇이며 "#ifdef objc "의 중요성은 무엇입니까?

또한 .pch 파일에서 확인 된 "#ifdef is_production"과 같은 매개 변수를 정의합니까?

도움이 되었습니까?

해결책

.pch is a Pre-Compile Header.

In the C and C++ programming languages, a header file is a file whose text may be automatically included in another source file by the C preprocessor, usually specified by the use of compiler directives in the source file.

#ifdef OBJC lets the compiler know that the code is Objective-C.

#ifdef IS_PRODUCTION is something you have defined on your own, a directive telling the compiler to do something only if this is defined, most-likely something for a PRODUCTION build.

다른 팁

The .pch file allows you to avoid importing common files like UIKit.h and Foundation.h. If you have those files imported in the .pch, your own classes don't need to import them.

The significance of #ifdef OBJC is so that you don't import headers containing objective-c code if you don't have the compiler set to build objective c code (hence avoiding lots of compiler errors).

You define parameters such as IS_PRODUCTION inside the target's build settings. I do it usually in "other C flags".

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