Yes, I know subclassing UIWindow is frowned upon, but my subclassed UIWindow is for debugging purposes only (it takes a screenshot of the current-page once a specific motion event is detected).
Anyway, I made a custom precompiler flag called DEBUG in my project’s Build Settings, but I’m having a problem getting it to load/function properly. Right now, it’s not taking the screenshot, but it is registering the occurrence of the motion event.
Here’s the code I have in the AppDelegate’s didFinishLaunchingWithOptions:
#if DEBUG
DebugWindow *debugWindow = [[DebugWindow alloc] init];
self.window = debugWindow; //'window' is declared in the AppDelegate's @interface file and synthesized as window=_window in the @implementation file
#else
self.window = _window;
#endif
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
Here is how to use debug flag
And here is the screenshot
Also in the release setting put the flag to 0
Like this -DDEBUG=0
This way you can achieve what you want to achieve.Let me know if it helps or not.