been researching this a while and not sure entirely what to do.

I want to allow users to switch debug mode either on or off. With debug mode on NSLogs will be printed to console.

currently I can set debug mode on or off in the build settings using a preprocessor (DEBUG) and I use the following code to "block" NSLogs.

#ifdef DEBUG
    NSLog(@"If you can see this then debug is on");
#endif

I have created a toggle switch in the settings page to get input from the user but I don't know how to use this input to then undefined/redefine DEBUG. Any ideas?

I am not sure if this is even possible so any alternate solutions would also be appreciated.

Many Thanks :)

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top