To display the results on the console in Playground in Xcode 9.4

Asked 1 years ago, Updated 1 years ago, 77 views

I saw some people asking similar questions, but I couldn't solve them in any way.
Learn how to display the results of the print function on the console in Playground.
On the Xcode Project side, the console is displayed without any problems.

Already tried method
·Specify Show debugger with Variables & Console View in the Running section

·View Activate Console
 Specify the execution method: ManManually Run /

There is no particular error indication and nothing is displayed on the console, so I am troubled.
Thank you for your cooperation.

xcode swift4

2022-09-30 20:24

2 Answers

In Xcoede 9.4.1, if you write a code fragment, you will see the print statement output in the bottom pane. The gray area to the right of the source code should also show the value of the variable.
In addition, if you click the icon like the three main lines next to the content of the gray variable to the right of the source code
The details will be displayed in a pop-up window.

At home, it looks like the attached picture.

Enter a description of the image here


2022-09-30 20:24

As stated in the comments section, I will supplement the information.

When you start the Playground editor for the first time, entering code or clicking the Run button (the default is Automatically Run) does not display the results of the run in the console.
In this case, once you have Quit Xcode and open the created Plyground file from Welcome to Xcode, the following pop-up will appear:After passing this authentication, you will be able to display the results on the console.

"Xcode needs to control another process to continue debugging.Please enter your password to allow."

You can now enter the password you set for the operating system to display the results live on the console.If you cancel or specify Manually Run, the same pop-up appears again when you click the Run button, so you can enter your password here to enable console output.

Unless you restart the operating system, you can only restart Xcode once you have authenticated, but if you restart the operating system itself, you will be prompted to authenticate again the first time you try to open the Playground file.
I don't know in detail what kind of configuration these steps are added to, but it seems to be a permission issue.Typically, it can be used without authentication.

Also, there is information that the Xcode Project may display similar contents in the above message when the emulator is started, but this question is a little different.In this case, the Xcode Project is able to debug and emulator activation without requiring authentication, which is only a symptom when using Playground.


2022-09-30 20:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.