<AppName>.pch file usage
What is the importance of .pch file and what is the significance of”#ifdef OBJC“?
Also, where do we define parameters like “#ifdef IS_PRODUCTION” which are checked in .pch file.
2 Solutions Collect From Internet About “<AppName>.pch file usage”
.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”.
- KVC string conversion not working for BOOL value
- XCode 8.1 crashes when I open .swift/.xib file
- Importing CommonCrypto in a Swift framework
- Parsing Hierarchical XML in Swift using NSXMLParser
- How to connect amazon RDS in iOS
- How prevent username from duplicate signUp in Firebase?
- Check if file is already saved to disk?
- GCDAsyncSocket in Swift
- How to integrate Facebook without redirect Safari browser in iOS app with latest FBSDK
- how to handle 1 to 3 fingers swipe gesture in iOS
- How to Build FFMpeg as iOS Framework
- Swift 2 iOS 9 Do Catch Try crashing with unexpected nil found
- cocoapods not installing
- Install iOS app directly from website – no password, no iTunes, no UDID
- Exception in iPad, UIImagePickerController must be presented via UIPopoverController