[IOS development-69] the output function is customized in the pch file. This method is generally adopted by company projects to facilitate development, testing, and release,
In the latest Xcode, no pch file exists by default, and you need to manually create the file.
In fact, a pch file is similar to a macro. Its content can be accessed and shared by other files.
Therefore:
-- You can define macro variables here
-- Of course, the actual usage is mostly used for testing. For example, the following statement indicates that we can use WPLog instead of NSLog to print the output test in the development and test phase. In the release phase, the WPLog will automatically expire. Generally, NSLog is rarely directly used in company projects. Replace is basically defined in the pch file.
# Ifdef DEBUG # define WPLog (...) NSLog (_ VA_ARGS _) # else # define WPLog (...) # endif
-- In the previous study, we found that an error was reported when using CGRect, which is actually a bad header file. In earlier versions of Xcode, the following code is used:
# Ifdef _ OBJC _ # import <UIKit/UIKit. h> # import <Foundation/Foundation. h> # endif
The latest Xcode version seems to be:
# Ifdef _ OBJC _ # import <Foundation/Foundation. h> # endif
Therefore, you can either add UIkit. h to each required header file or add it in the pch file.