[newbie] How do I debug a variables value?

Discussion in 'iOS Programming' started by Danneman101, Jan 22, 2009.

  1. Danneman101 macrumors 6502

    Joined:
    Aug 14, 2008
    #1
    How do I debug (or see) a variables value if I dont have any room for text in my app? Is there a console that you can output text with debug-info to that runs at the same time as the simulator, kind of like you have in Flash-development?
     
  2. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
  3. Danneman101 thread starter macrumors 6502

    Joined:
    Aug 14, 2008
    #3
    Thanks for the quick answer, jnic.

    However, I need to view a variables content when navigating the app, and doing run->console only seem to do the initial code-setup.

    Perhaps the easiest way would probably be to do a message-window:
    Code:
    // DEBUG: Alert-window
    UIAlertView *debugAlert = [[UIAlertView alloc] initWithTitle:tempUrlString message:@"=savedUrlString" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
    [debugAlert show];
    
     
  4. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #4
    For real debugging, add some breakpoints and Run > Debugger.

    There's a good primer in the docs on debugging in Xcode.
     
  5. CommanderData macrumors regular

    Joined:
    Dec 1, 2007
    #5
    See my response in "that other iPhone SDK forum" you posted in ;)
     
  6. Danneman101 thread starter macrumors 6502

    Joined:
    Aug 14, 2008
    #6
    As I said in the "that other iPhone SDK forum" ;) I was under the impression that the console couldn't run alongside and in real-time with the simulator and only captured the code executed at setup. Stupid assumption, really, since that would make it really limited :p

    This is much better than having a lot of pop-ups appearing with debug-info, so thanks (all of you) for clearing this out - debugging just became much easier :)
     

Share This Page