Skip to Content
COCOA學習手冊--使用OBJECTIVE-C第三版
book

COCOA學習手冊--使用OBJECTIVE-C第三版

by Paris Buttfield-Addison, Jonathon Manning
June 2013
Intermediate to advanced
360 pages
6h 50m
Chinese
GoTop Information, Inc.
Content preview from COCOA學習手冊--使用OBJECTIVE-C第三版
效能工具與偵錯器
|
271
檢查記憶體內容
當程式在偵錯器中停下來時,你可以看到記憶體裡的變數與物件的當前狀態。
變數視圖位在偵錯區的左側區段,當程式被停止時,變數視圖顯示該時點當下所存在的
變數。
變數視圖顯示變數的資訊。如果變數是整數或
BOOL
之類的簡單型別,它們的值被顯
示;如果變數是
NSString
NSArray
之類的東西,有關它們的摘要資訊被顯示,像是字
串的內容,或者陣列裡的項數。
如果你在程式被停止時使用執行流控制按鈕,變數視圖便會更新,顯示任何改變。如果
變數發生改變,它會被突顯成藍色。
變數視圖也允許你迅速把
description
訊息傳送給任何物件並且看到結果。要這樣做,
以滑鼠右鍵點擊變數,並且選擇 Print Description
操作偵錯器主控台
偵錯區的右手邊是主控台,主控台是偵錯器的命令列介面,並且允許你直接存取偵錯器
的一些低階的強大功能。
透過主控台操作 LLDB 是一個龐大的主題,足以使用專書論述,但是在這一節裡,我們
將討論如何把主控台運用在它那最具威力的目的︰執行自訂的 Objective-C 程式碼,操
作你的程式之變數。
假設偵錯器已經停駐在某個方法的中斷點。在此方法中,
myArray
NSArray
,而且你想
要檢查它的內容。
為了看到
myArray
裡有多少個項目,請將下列這一行文字輸入主控台︰
print (int)[myArray count]
注意,這裡沒有分號。在主控台裡,每一行的結尾並沒有分號。
當你在偵錯器裡呼叫 Objective-C 方法時,必須確切指明這個方法將回傳 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

網頁互動式資料視覺化:使用D3

網頁互動式資料視覺化:使用D3

Scott Murray
深入淺出代數

深入淺出代數

Tracey Pilone, Dan Pilone
自然语言处理实战:从入门到项目实践

自然语言处理实战:从入门到项目实践

Sowmya Vajjala, Bodhisattwa Majumder, Anuj Gupta, Harshit Surana

Publisher Resources

ISBN: 9789862768136