Lập trình Wrox Professional Xcode 3 cho Mac OS part 65

Mô tả đối tượng Giống như định dạng dữ liệu, nhiều ngôn ngữ hướng đối tượng đã thông qua quy ước để chuyển đổi bất kỳ đối tượng vào một đại diện văn bản. Trong Java, đây là toString () chức năng. | 490 CHAPTER 18 DEBUGGING Object Descriptions Like data formatters many object-oriented languages have adopted conventions for converting any object into a textual representation. In Java this is the toString function. Objective-C uses the - NSObject description method. If you are using an object that supports one of these standards you can use the Run Variables View Print Description to Console command. The debugger invokes the standard to string function on the object and sends the result to the debugger console. WATCHPOINTS Watchpoints are breakpoints for data. You can make any variable a watchpoint. Whenever the debugger detects that the value of that variable has changed it stops your application. Watchpoints sound great but they are fairly limited. The biggest problem is that your application can t execute any code where the watchpoint variable is out of context so they are mostly useful for global variables that are always in scope and for catching state changes in a loop. You set a watchpoint by first selecting a variable in the variables pane. Choose the Run Variables View Watch Variable command. This places a magnifying glass icon next to the variable as shown in Figure 18-35. Start the program executing again and it breaks at the point just before the variable is altered with a dialog box explaining what is about to happen also shown in Figure 18-35. FIGURE 18-35 You can choose to acknowledge the event and leave the watchpoint set or disable the watchpoint by clicking the Disable button. Watchpoints are automatically deleted whenever your application exits the context where the watchpoint variable exists. Watchpoints are not retained between debug sessions. You can create an effect similar to a watchpoint using a breakpoint conditional like i 0. It s not as convenient as a watchpoint but it s more durable. To remove a watchpoint select the variable being watched and choose Run Variables View Watch Variable again to remove the check mark. Download at .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.