Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6168869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:45:42+00:00 2026-05-23T22:45:42+00:00

Yes, I know subclassing UIWindow is frowned upon, but my subclassed UIWindow is for

  • 0

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];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:45:42+00:00Added an answer on May 23, 2026 at 10:45 pm

    Here is how to use debug flag

    #if DEBUG == 1
    #define CMLog(format, ...) NSLog(@"%s:%@", __PRETTY_FUNCTION__,[NSString stringWithFormat:format, ## __VA_ARGS__]);
    #define MARK    CMLog(@"%s", __PRETTY_FUNCTION__);
    #define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate];
    #define END_TIMER(msg)  NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]);
    #else
    #define CMLog(format, ...)
    #define MARK
    #define START_TIMER
    #define END_TIMER(msg)
    #endif
    

    And here is the screenshot

    enter image description here

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(Yes I know I can call Java code from Scala; but that is pointless;
Yes I know, this title isn't really helpfull but this is the exact problem.
I have the following code (Yes I know it's quite long winded, but I
I know the Sales pitch answer is yes to this question, but is it
Yes i know the phrase virtual constructor makes no sense but i still see
Yes I know global variables is a bad practice, but ease up on that
New to NodeJS. Yes I know I could use a framework, but I want
First, yes i know this is a big security NONO . But the scenario
Yes I know Ruby doesn't have pointers, but that's the closest I could get
yes i know how silly and dumb this question is, but i have been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.