How to print something to the console in Xcode?

后端 未结 6 1147
逝去的感伤
逝去的感伤 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 21:21

    @Logan said it perfectly. but i would like to add an alternative here,

    if you want to view logs from just your application then you can make a custom method that keeps saving the log to a file in documents directory & then you can view that log file from your application.

    There is one good advantage for developers of the app after the app has been released & users are downloading it. Because your app will be able to send logs & crash reports to the developers (of course with the permissions of the device user !!!) & it'll be the way to improve your application.

    Let me know (To other SO users), if there is another way of doing the same thing. (Like default Apple feature or something)

    Let me know if it helps or you want some more idea.

提交回复
热议问题