How to print something to the console in Xcode?

后端 未结 6 1052
逝去的感伤
逝去的感伤 2021-02-06 20:45

How do you print something to the console of Xcode, and is it possible to view the Xcode console from the app itself?

Thanks!

6条回答
  •  情话喂你
    2021-02-06 20:59

    You can also use breakpoints. Assuming the value you want is defined within the scope of your breakpoint you have 3 options:

    print it in console doing:

    po some_paramter
    

    Bare in mind in objective-c for properties you can't use self.

    po _someProperty
    po self.someProperty // would not work
    

    po stands for print object.


    Or can just use Xcode 'Variable Views' . See the image

    I highly recommend seeing Debugging with Xcode from Apple


    Or just hover over within your code. Like the image below.

提交回复
热议问题