Choose from this menu the macOS or iOS device or simulator the build and run operation will execute on. Three buttons control the visibility of the navigator area, debug area, and utility area.
These buttons, known as view controls, have matching commands with keyboard shortcuts in the View menu. In addition to the areas and controls located in the Xcode main window panels and toolbar, the Xcode main menu bar includes the Product and Debug menus.
These menus provides a convenient, configurable keyboard mapping for many of the more common commands used during debugging sessions. The Debug menu provides convenient keyboard stepping commands for use when you pause your app and analyze what happens line by line. The debug area opens at the bottom of the Xcode main window below the source editor when you build and run your app.
It contains the debug bar, the variables view, and the console. To hide or show the debug area click the center button in the view controls group located in the main window toolbar. When you build and run a program in Xcode, the debug bar appears at the bottom of the editor pane. The debug bar includes buttons to:. Step over; that is, execute the current line of code and, if the current line is a function or method, step out to the next line in the current file.
Step in; that is, execute the current line of code and, if the current line is a routine, jump to the first line of that routine. Step out of a jumped-to routine; that is, complete the current routine and step to the next routine or back to the calling routine.
The action of this button differs from the view controls in the Xcode main window toolbar in that when you run a debugging session, it controls the view of both variable view and console panels but leaves the debug bar accessible. This is useful when you are working primarily in the source editor while debugging and want to maximize the amount of space you have to view your source code.
Breakpoint Activation button. This button acts as a toggle to deactivate and activate all breakpoints in your app simultaneously. You can suspend the execution of your app by clicking the Pause button, which toggles between to pause and to continue.
More commonly, however, you set a breakpoint to pause your app at a planned location. Step controls. When your app is paused, the currently executing line of code is highlighted in green.
You can step through execution of your code using step over , step into , and step out. Step over will execute the current line of code, including any methods. If the current line of code calls a method, step into starts execution at the current line, and then stops when it reaches the first line of the called method. Step out executes the rest of the current method or function. The stepping controls have alternative operations for working with disassembly or threads.
You use the Control and Control-Shift modifier keys to call these alternatives. Press Control to step by assembly language instruction instead of by statement the step icons change to show a dot rather than a line under the arrow or Control-Shift to step into or over the active thread only while holding other threads stopped the step icons show a dashed rather than solid line below the arrow.
Debug View Hierarchy button. Click to investigate the relationship of view objects both in a 3D rendering and in a hierarchical list in the debug navigator. See Debugging the View Hierarchy for more information. Simulate Location button. Clicking this button presents a menu of locations to choose from. You choose one to tell a device or the simulator to report that location to your app as it runs. When your app is paused, this jump bar provides a convenient way to navigate through all processes and threads, and lets you jump to specific stack frames for the purpose of inspecting the program flow or setting breakpoints.
The variable view provides the primary way to inspect the state of variables when an app is paused. Variable list. The variable view lists each variable available in the context where the app is paused. Each variable at the top level takes up a row in the list. Disclosure triangles are at the far left of the row, followed by an identifying icon, the variable name, type, and value. The variable name is followed by the variable value as generated by the data formatter for the variable type.
As you use the stepping controls in the debug bar to execute your app line by line, you can see the variable values that result from each operation in the source. Variable view menu. Right- or Control-click a variable in the list to display commands that act on the variable.
Some of the commands duplicate other ways to obtain the same behavior. An equivalent to using po in the console or using the Print Description button in a tool tip. View Value As. Clicking on the command presents a menu of standard types. The menu includes a Custom Type option, which presents a pop-up editor that you use to input a custom data format.
Edit Value. Alternatively, you can double-click the variable value in the list directly to achieve the same function. Edit Summary Format. Presents an editor allowing you to change the data formatter by entering a new formatter representation for the variable.
Add Expression. Allows you to add an expression to the variable list for the debugger to evaluate and present a result in variable view. An option in the editor allows you to add the expression to the variable list in all stack frames.
Creates a watchpoint that reports the value of a variable as your app runs. Watchpoints are managed in the breakpoint navigator. Show Types and Show Raw Values. Allow you to adjust how much information is presented for each variable in the variable view list.
Sort By. Allows you to choose to show variables by their order of appearance in the source or by name, in ascending or descending order when showing by name.
View control menu. The variable view can display both variables and registers. You specify which items to display using the pop-up menu in the lower-left corner. By default, it is set to Auto. The options are:. Filter bar. Use the search field to filter the items displayed in the variables pane. Quick Look button. Use Quick Look to produce a visual rendering depending upon the type of the selected variable.
Quick Look graphical rendering is particularly useful when you are trying to see a complex object and how it is being drawn or rendered. For example, this illustration shows a UIBezierPath object in the variables view:. Print Description button. Select a variable in the list and click the Print Description button to print textual information about the variable to the console pane. It is equivalent to using the LLDB po command. The debug area console is a command line environment that you can use to interact with an app or with LLDB.
Command-line environment. When the app is running during a debugging session, it can read from the console using stdin and output to the console using stdout and stderr. Logging with NSLog is sent to the console as well. Console output persists throughout a debugging session, you can see a listing of outputs created for the entire session.
When you finish a session and rerun the app, the console is cleared. You can review the console contents from previous debugging sessions by going to the Report navigator and checking the contents of the debug sessions stored there. Output control. You specify the type of output the console displays with the pop-up menu in the lower-left corner of the console pane:. Clear console button. The Trash button at the lower right allows you to clear the console at any time in your session. The full console output is logged to the Reports navigator.
Click View Device Logs. Right-click on the App Crash and select Export Log. Enter the log file name and the destination then click Save. Breakpoints are locations in your code where Xcode will pause so that you can inspect the state of your program. To place a breakpoint , click to the left of a line of code you want to pause on — in the gutter, where the line numbers are visible if you use them. Right click in the local variables window to see the " Watch Expression" menu command.
Type the variable name and the variable will be added. Just right click on a var and select " Watch var". Getting device logs from Xcode Connect your phone to your laptop and open Xcode.
Select Device and Simulators from the Window menu. Select your device from the left panel. Make sure that the logs are expanded. Click the Save Console button at the bottom right to save the log information within the console. What is Xcode. It is the only officially-supported tool for creating and publishing apps to Apple's app store, and is designed for use by beginners and experienced developers.
Plug your iOS device into your Mac using a lightning cable. You may need to select to Trust This Computer on your device. Select your device and then select the Connect via network checkbox to pair your device:. Identify the purpose of key files that are created with an Xcode project template. Open and switch between files in a project. Run an app in iOS Simulator. Add, move, and resize UI elements in a storyboard.
Edit the attributes of UI elements in a storyboard using the Attributes inspector. Plug your iPhone into your computer. You can select your device from the top of the list. Unlock your device and? R run the application. You'll see Xcode install the app and then attach the debugger. Enter the following command at the Terminal prompt:? Press enter or return. Close Terminal. To view your Mac system logs , launch the Console app. Skip to main content. This browser is no longer supported.
Download Microsoft Edge More info. Contents Exit focus mode. Where can I find my version information and logs? Please rate your experience Yes No. Any additional feedback?
0コメント