问题
.pch as its name shows pre-compiler header, I have defined a macro in the file so that app can decide in the very beginning of the app compilation.
What I need is, possible to load any macro by assigning the values dynamically something like NSUserDefaults
and checking the condition in .pch
file itself.
If user disable logs from screen (switch), there should be no logs
else... it can print logs, least bother about Debug/Release mode.
I have " #define NSLog(FORMAT, ...) TFLog((@"%s [Line %d] " FORMAT), PRETTY_FUNCTION, LINE, ##__VA_ARGS__) "
into my .pch file.
I am looking something like this :
#if REMOTEDEBUG_ENABLED // CHECK FOR NSUserDefaults values and comparing for logs
" #define NSLog(FORMAT, ...) TFLog((@"%s [Line %d] " FORMAT), PRETTY_FUNCTION, LINE, ##__VA_ARGS__) "
#endif
Here is the reference link, but that assigning the value to macro from the project settings so didn't worked in my case.
I need to check the condition based on NSUserDefaults. Anybody, please let me, how I can achieve this OR any alternate where the app can decide either to print the logs/not using the macro. Thanks in advance !!!
来源:https://stackoverflow.com/questions/21275316/dynamic-assigning-of-value-to-macro-function-pch-file-and-checking-condition-p