Forum Archive

Debugging standalone

zencuke

I'm having a heck of a time debugging my standalone app. I built it using omz's template. It fails in a way that it doesn't fail as a script. But the biggest problem is I can't figure out how to debug. The actual code running is not in source form. I'm getting an exception and can't figure out what it means. I was trying to narrow down where in my python code it was happening but I can't figure out how to get debug info out. Standard out goes to a screen that is hidden when the app runs and never gets revealed once the exception happens. Breakpoints are useless because they are in ObjectiveC where I don't have source code.

Is there any way way to write to the app debug log from python? That would show on the Mac and is how I usually debug iOS apps. (And breakpoints of course.) It is usually just stdout from ObjectiveC.

Any suggestions? It seems like very few people use this functionality because I am not getting answers to my questions. I have made no progress for two days which is discouraging. Is this (stand alone apps) a supported feature or should I just give up? I don't think I'm going to be able to solve this on my own.

-steve

Dalorbi39

Could you post your error?
It sound's like you suspect that Omz's Template is the main suspect, is that right?

omz

It looks like I forgot to include a certain file in the static library...

Could you try adding the following code to AppDelegate.m (just paste it at the bottom):

@interface OMFirstResponderFinder : NSObject

@property (nonatomic, retain) UIResponder *firstResponder;

@end

@implementation OMFirstResponderFinder

- (void)dealloc
{
    [_firstResponder release];
    [super dealloc];
}

@end

@implementation UIResponder (OMFirstResponder)

- (void)om_putFirstResponderIntoFinder:(OMFirstResponderFinder *)finder
{
    if (self.isFirstResponder) {
        finder.firstResponder = self;
    }
}

+ (UIResponder *)om_firstResponder
{
    OMFirstResponderFinder *finder = [[[OMFirstResponderFinder alloc] init] autorelease];
    [[UIApplication sharedApplication] sendAction:@selector(om_putFirstResponderIntoFinder:) to:nil from:finder forEvent:nil];
    return finder.firstResponder;
}

@end
zencuke

That resolved the problem. Thanks.

zencuke

@Dalorbi I didn't have enough data to suspect anything specific. A bug in the template was one possibility. On the other hand I could think of plenty of things that might have been wrong in my code; possibly a race condition of some kind. Too many times I have blamed the tool but eventually found my own mistake. I have occasionally found tool bugs (looks this this was one of them) but it is seldom the most likely guess. Suspecting my own code is usually more productive. I just couldn't figure out how to debug this one.