how to create a breakpoint's log message action in xcode?

前端 未结 3 854
后悔当初
后悔当初 2020-12-28 08:26

Been watching a WWDC video today about new features in xCode 4. They have mentioned that it a good idea to use log message actions on breakpoints along with \"automatically

3条回答
  •  梦谈多话
    2020-12-28 09:12

    Here is a similar solution using NSLog, which might be fewer characters than the other solutions.

    debugger command using NSlog

    However, unless you add the void like this:

    po (void)NSLog(@"the person name is: %@", p.name)
    

    you will get an annoying "nil" printed out with your log. for example:

    (lldb) po NSLog(@"foo")
     nil
    2013-06-19 14:42:59.025 TheMove[95864:c07] foo
    
    (lldb) po (void)NSLog(@"foo")
    2013-06-19 14:43:10.758 TheMove[95864:c07] foo
    

    If you can live with the nil (I can) it's faster to type and easier to remember just the po

提交回复
热议问题