• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Xcode 4.5.2 Behaviors can cause Heisenbug!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Xcode 4.5.2 Behaviors can cause Heisenbug!


  • Subject: Xcode 4.5.2 Behaviors can cause Heisenbug!
  • From: Matt Neuburg <email@hidden>
  • Date: Sat, 22 Dec 2012 10:55:14 -0800

This is the only code in my app (in the app delegate):

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.rootViewController = [ViewController new];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    NSLog(@"wtf1");
    NSLog(@"start %@", NSStringFromSelector(_cmd));
    NSLog(@"wtf2");
    NSLog(@"end %@", NSStringFromSelector(_cmd));
}

On launch, I'm getting the following absolutely unbelievable messages in the Console:

Bizarro[10416:907] wtf1
Bizarro[10416:907] start applicationDidBecomeActive:
Bizarro[10416:907] wtf2
Bizarro[10416:907] end applicationDidBecomeActive:
Bizarro[10416:907] start applicationDidBecomeActive:
Bizarro[10416:907] wtf2
Bizarro[10416:907] end applicationDidBecomeActive:

Huh? How can applicationDidBecomeActive: get called twice? And if it's getting called twice, ***how come it starts in the middle***, skipping the logging call to @"wtf1" the second time?

After losing a couple of hours over this (Apple, feel free to send me my usual consulting-fee for this time lost), I had an amazing brainstorm and looked at the times (not shown above). They were the same times for the repeated messages, right down to the thousandth of a second.

After some futzing around, I turned off my Behavior for Running -> Generates Output. Problem solved! It turns out that my Behavior was causing some logging messages to appear twice.

For the record, and in case you'd like to try it on your own machine, my Behavior was simply this: "Show tab named Console in active window". That's all; everything else unchecked.

I hope this will help some other poor soul. Getting weird console messages? Look closely at the times: some of them may be the same message *reported* twice by Xcode, not the same message being *logged* twice by your app. m.

--
matt neuburg, phd = email@hidden, http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Searching in xib files?
  • Next by Date: Re: Searching in xib files?
  • Previous by thread: Re: Searching in xib files?
  • Next by thread: Errors linking against libLLVMCore
  • Index(es):
    • Date
    • Thread