2.偏好設(shè)置
通過(guò)“command+,”快捷鍵或”Xcode|Preferences”菜單呼出偏好設(shè)置。
(1)主題及字體(Preferences->Fonts & Colors)
選中一種主題(theme)铭污,例如“Midnight”铣猩,然后shift選擇Source Editor/Console中的所有項(xiàng)募闲,點(diǎn)擊Fonts設(shè)置字體笔喉。Xcode默認(rèn)字體為menlo尸诽,可選Consolas、Monaco等其他等寬字體绑改。
(2)文本編輯配置(Preferences->Text Editing)
Editing:
Show Line Numbers:在gutter中顯示行號(hào)谢床。
Code folding ribbon:顯示折疊ribbon。
Page guide at column:顯示一行最多支持80個(gè)字符的提示分割線厘线。
Indentation:
Prefer indent using:Spaces(為保持一致的視覺(jué)呈現(xiàn)和行末注釋對(duì)齊识腿,建議使用空格)
Tab width:4 spaces(tabexpand,1個(gè)tab=4個(gè)空格)
Indent width:4 spaces(自動(dòng)縮進(jìn)步長(zhǎng)=4個(gè)空格)
(3)SCM(Preferences->Source Control)
Enable Source Control:?jiǎn)⒂?禁用XCode自帶Source Control Manager(SCM)皆的。
(4)SDK/Simulator(Preferences->Downloads)
Downloads->Components:可下載SDK和Simulator覆履。
(5)構(gòu)建輸出目錄(Preferences->Locations->Locations)
當(dāng)選擇為Default時(shí)蹋盆,Derived Data的目錄為~/Library/Developer/Xcode/DerivedData费薄。
當(dāng)選擇為Relative時(shí),Derived Data的目錄為當(dāng)前.xcodeproj所在的目錄栖雾。
當(dāng)選擇為Custom時(shí)楞抡,Derived Data的目錄需自定義。
不建議使用絕對(duì)路徑析藕,因?yàn)閷?xiě)死之后召廷,換環(huán)境或換平臺(tái),又要重新修改路徑,建議使用相對(duì)路徑(Relative)竞慢。
3.代碼閱讀
(1)View Navigator
command+0:Show/Hide left tool panel
command+1-8:Project/Symbol/Find/Issue/Test/Debug/Breakpoint/Log Navigator
option+command+0:Show/Hide right tool panel
option+command+1/2:show the file/quick help inspector
(2)View Editor Organization
control+1:Show Related Items(例如Superclasses/Subclasses先紫、Callers/Callees、Protocol Implementor/Implemented筹煮、Includes/Included By)遮精。可輸入實(shí)時(shí)搜索匹配败潦。
control+2/3:Show Previous/Next History本冲。可輸入實(shí)時(shí)搜索匹配劫扒。
control+4:Show Top Level Items檬洞。
control+5:Show Group Files(當(dāng)前文件夾內(nèi)的所有文件)」导ⅲ可輸入實(shí)時(shí)搜索匹配添怔。
control+6:Show Document Items(當(dāng)前文件的Symbols)∶瓢澹可輸入實(shí)時(shí)搜索匹配澎灸。
可直接選中符號(hào),然后“Navigate->Reveal in Symbol Navigator”遮晚,打開(kāi)該接口的符號(hào)列表性昭。
(3)Focus Switch
command+J:焦點(diǎn)切換(Move Focus),可配合鼠標(biāo)和方向鍵县遣。帶‘+’的“Move focus to a new assistant editor”可以快速在輔助編輯窗口中打開(kāi)頭文件(*.h)/實(shí)現(xiàn)文件(*.m糜颠,*.mm)。
shift+command+J:在項(xiàng)目導(dǎo)航中定位當(dāng)前文件(Reveal in Project Navigator)萧求。
(4)Symbol Jump
control+command+↑/↓:切換頭文件/實(shí)現(xiàn)文件(switch between a source file (.m,*.mm,*.cc) and the associated header file(.h))其兴。
shift+command+O:Open Quickly,可快速查找文件夸政、符號(hào)元旬。
command+點(diǎn)擊Editor中選中的符號(hào):跳轉(zhuǎn)到符號(hào)定義(jump to definition)。
control+command+J:跳轉(zhuǎn)到指定符號(hào)的定義處或?qū)崿F(xiàn)處(Go to Declaration/Definition)守问。有時(shí)工程正在Loading匀归、Indexing或Processing files時(shí),“command+點(diǎn)擊”無(wú)法響應(yīng)耗帕,此時(shí)可試試control+command+J穆端。
在Project Navigator中選中文件右鍵或通過(guò)菜單“File->Show in Finder”:在Finder中定位該文件。
(5)Symbol Navigator
command+點(diǎn)擊Editor中選中的非單一層次定義符號(hào):Show in Symbol Navigator:
filter0:底部輸入符號(hào)(show symbols with matching name)= filter1 result+filter3 result
filter1:show only class and protocol symbols (hide other global symbol types)仿便,包括project和system層次体啰。
filter2:show only project-defined symbols攒巍,過(guò)濾顯示當(dāng)前工程中的符號(hào)。filter2的結(jié)果是filter1的子集荒勇,較常用柒莉。
filter3:show only containers(hide members),過(guò)濾顯示包含該單詞的符號(hào)沽翔。
(6)Help
option+點(diǎn)按:查看選中符號(hào)的幫助提示(Quick Help for Selected Item)常柄。
option+雙擊:打開(kāi)選中符號(hào)的幫助文檔。
4.代碼編輯
(1)File | New
control+command+N:File | New | Workspace
shift+command+N:File | New | Project
(2)Text Editing
command+[/]:向前/向后縮進(jìn)
option+command+[/]:Move Line Up/Down
command+/:注釋選中的代碼
Parentheses/Brackets/Braces Matching:雙擊某個(gè)分隔符(如()搀擂、[]西潘、{} 等),Xcode會(huì)選中匹配代碼塊哨颂。
(3)Eidtor Window/Tab Switch
command+shift+[/]:切換標(biāo)簽頁(yè)
單指左右滑動(dòng)(control+command+←/→):在單標(biāo)簽頁(yè)打開(kāi)的多個(gè)文件間切換
(4)Code Folding
option+command+←/→:折疊當(dāng)前代碼塊
option+shift+command+←/→:折疊該文件內(nèi)所有代碼塊(方法/函數(shù))
(5)Console & Scheme
shift+command+Y:顯示控制臺(tái)(Show/Hide the debug area)
option+command+R:編輯配置(Edit Scheme)
(6)Gutter & Ribbon
焦點(diǎn)列:灰色深度與代碼嵌套深度相關(guān)喷市,鼠標(biāo)懸停可突出顯示右側(cè)相應(yīng)代碼塊威恼,鼠標(biāo)單擊可折疊右側(cè)相應(yīng)代碼塊(Code Folding)品姓。
說(shuō)明:從左到右,依次是“導(dǎo)航窗格(Navigator)->邊列(Gutter)->焦點(diǎn)列(Focus
Ribbon)->代碼編輯窗口(Standard Editor)”箫措。
(7)Auto Completion
esc(command+.):就當(dāng)前輸入上下文呼出/隱藏Auto
Completion提示:上下方向鍵在提示中選擇選項(xiàng)腹备,enter(return)選中,tab可一截一截匹配斤蔓;tab可在各個(gè)占位符之間移動(dòng)植酥。
輸入Objective-C對(duì)象及 ],自動(dòng)完成中綴符(infixnatation)包圍弦牡。
(8)Find & Replace
command+F:當(dāng)前文件查找友驮。
option+command+F:當(dāng)前文件替換。
Find:可指定查找內(nèi)容(Text/References/Definitions/Regular Expression)驾锰;
放大鏡:下拉可查看最近查找歷史卸留;
In Project:查找范圍(可指定Group);
Text:匹配規(guī)則(可指定Containing椭豫,Matching耻瑟,Starting with,Ending with)赏酥;
Case:是否區(qū)分大小寫(xiě)(可指定 Matching/Ignoring)喳整。
shift+command+F(command+3):全局查找。也可以在選擇符號(hào)后今缚,右鍵(control+點(diǎn)擊)->Find Selected Text in workspace...
option+shift+command+F:全局替換算柳。
Replace:逐個(gè)替換低淡;
All:所有替換姓言;
Done:替換完成瞬项。
5.輔助編輯(Assistant Editor)
Assistant Editor有點(diǎn)類似VC中的Code Definition Window。
option+command+enter:打開(kāi)Assistant Editor何荚。
command+enter:關(guān)閉Assistant Editor囱淋。
使用快捷鍵進(jìn)行切換或跳轉(zhuǎn)動(dòng)作時(shí),若同時(shí)按下option可以在輔助編輯窗口中打開(kāi)相應(yīng)文件或符號(hào)(For optional navigation (Option-clicking or Option-choosing a file), opens the file in a new Assistant editor pane.)餐塘。若在輔助窗口中操作妥衣,則在主窗口(Standard Editor)中打開(kāi)。
option+點(diǎn)擊Project Navigator中選中的文件:在輔助編輯窗口中打開(kāi)選中文件戒傻。
option+command+點(diǎn)擊Editor中選中的符號(hào):在輔助編輯窗口中打開(kāi)符號(hào)定義(jump to definition in assistant editor)税手。
option+control+command+↑/↓:在輔助窗口中打開(kāi)對(duì)應(yīng)的頭文件(*.h)/實(shí)現(xiàn)文件(*.m,*.mm,*.cc)。
點(diǎn)擊查看shift+command+O需纳、shift+command+F(command+3)選中的文件或符號(hào)時(shí)芦倒,可同時(shí)按下option在輔助編輯窗口中打開(kāi)。
在control+1~6中打開(kāi)選擇結(jié)果時(shí)不翩,均可同時(shí)按下option在輔助編輯窗口中打開(kāi)兵扬。
若在按下option的同時(shí)按下shift通常會(huì)出現(xiàn)一個(gè)導(dǎo)航窗格,可選擇在new window/tab/assistant-editor顯示打開(kāi)口蝠。
ForOption-Shift navigation (Option-Shift-click or Option-Shift-choose a file), Xcode displays a graphical navigation chooser showing the current layout. The chooserprompts you to open the file in anyopen editor pane in any window and tab, or to open the file in anew editor pane, window, or tab.
6.環(huán)境變量(Build Setting Macros)
(1)查看環(huán)境變量宏
命令行進(jìn)入HelloWorld工程目錄器钟,執(zhí)行xcodebuild命令并帶上“-showBuildSettings”參數(shù):
$ xcodebuild -project HelloWorld.xcodeproj -target HelloWorld -configuration Debug -showBuildSettings > xcodebuild_showBuildSettings.txt
則xcodebuild_showBuildSettings.txt中保存了Build settings for action build and target "HelloWorld”,其中dump了所有的環(huán)境變量妙蔗。
(2)Xcode5(Mac OS X 10.9)的部分環(huán)境變量
約定1:~=當(dāng)前賬戶的HOME目錄傲霸,例如“/Users/faner”。
約定2:build構(gòu)建基礎(chǔ)路徑:BUILD_PATH = ~/Library/Developer/Xcode/DerivedData/Build眉反∧祝可通過(guò)“File->Project Settings”查看Derived Data Location。
約定3:環(huán)境變量宏(Build Setting Macros)引用格式:${MACRO}禁漓,同Build Phases Run Script中的語(yǔ)法跟衅。
下面是摘選自xcodebuild_showBuildSettings.txt的部分常用環(huán)境變量。
(a) ARCH & PLATFORM & SDK
ARCHS = i386
CURRENT_ARCH = i386
PLATFORM_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
PLATFORM_NAME = macosx
SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
SDK_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
SDK_NAME = macosx10.9
(b) PROJECT & SOURCE
PROJECT = HelloWorld
PROJECT_DIR =~/Projects/Learn Objective-C/HelloWorld
PROJECT_FILE_PATH =${PROJECT_DIR}/HelloWorld.xcodeproj
PROJECT_NAME = HelloWorld
SOURCE_ROOT =${PROJECT_DIR}
SRCROOT =${PROJECT_DIR}
(c) BUILD & CONFIGURATION
BUILD_DIR =BUILD_PATH/Products
BUILD_ROOT =BUILD_PATH/Products
BUILT_PRODUCTS_DIR =BUILD_PATH/Products/Debug
CONFIGURATION = Debug
CONFIGURATION_BUILD_DIR =BUILD_PATH/Products/Debug
CONFIGURATION_TEMP_DIR =BUILD_PATH/Intermediates/HelloWorld.build/Debug
(d) PRODUCT & TARGET
PRODUCT_NAME = HelloWorld
PRODUCT_TYPE = com.apple.product-type.tool// Project Template: Command Line Tool
TARGET_BUILD_DIR =BUILD_PATH/Products/Debug
TARGET_NAME = HelloWorld
(3)設(shè)置環(huán)境變量
Product -> Edit Scheme(option+command+R)->Arguments->Environment Variables中可以添加自定義環(huán)境變量(Name為名稱播歼,Value為值)伶跷。
7.運(yùn)行調(diào)試
(1)Console
shift+command+Y:顯示控制臺(tái)(Show/Hide the debug area)
shift + command + K:清除控制臺(tái)(Clean)
(2)Build
Product -> Edit Scheme(option+command+R)->Info->Build Configuration:選擇生成版本(Debug or Release)
command + B:構(gòu)建(Buid)
(3)Target
一個(gè)Target是指在一個(gè)Project中構(gòu)建的一個(gè)產(chǎn)品,它包含了構(gòu)建該產(chǎn)品的所有文件秘狞,以及如何構(gòu)建該產(chǎn)品的配置叭莫。
一個(gè)定義好構(gòu)建過(guò)程的Target成為一個(gè)Scheme,可在Scheme中定義Target的六種構(gòu)建過(guò)程:Build/Run/Test/Profile/Analyze/Archive烁试。
Product -> Edit Scheme(option+command+R)->Manage Schemes可對(duì)Scheme的六種構(gòu)建過(guò)程進(jìn)行配置(可配置項(xiàng)包括Info雇初、Arguments、Options)减响。
在Project Navigator中選中某個(gè)xcodeproj(例如QQ.xcodeproj)靖诗,將進(jìn)入Project Setting頁(yè)面郭怪,可點(diǎn)擊左側(cè)圖標(biāo)show/hide project and targets list:
點(diǎn)擊targets項(xiàng)可分別設(shè)置各target的Build Settings;右擊可對(duì)target進(jìn)行delete刊橘。
(4)Issue & Errors
編譯錯(cuò)誤(error)和警告(warning)過(guò)多時(shí)鄙才,只顯示編譯錯(cuò)誤:
點(diǎn)擊底端的感嘆號(hào),即可只顯示編譯錯(cuò)誤促绵,忽略編譯警告:
(5)Run
command + R:運(yùn)行(Run)攒庵,可能會(huì)先編譯。若按下control直接運(yùn)行上次build的product(Run Without Building)败晴。
command + .:停止運(yùn)行(Stop)
(6)Breakpoint
command + \:當(dāng)前行設(shè)置/取消斷點(diǎn)浓冒;通過(guò)鼠標(biāo)點(diǎn)擊藍(lán)色斷點(diǎn)來(lái)啟用/禁用當(dāng)前行斷點(diǎn)。
command + Y:全局激活或禁用所有的斷點(diǎn)尖坤,激活進(jìn)入調(diào)試模式(此時(shí)斷點(diǎn)藍(lán)色可見(jiàn))裆蒸。
邊列(Gutter)中的斷點(diǎn)/警告可右鍵呼出Reveal in Breakpoint/Issue Navigator。
trick:編輯斷點(diǎn)(Edit Breakpoint):
Condition:設(shè)置斷點(diǎn)的觸發(fā)條件糖驴,例如“i==3”(注意不能有空格)表示當(dāng)i等于3時(shí)該斷點(diǎn)才會(huì)被觸發(fā)僚祷。
Ignore:設(shè)置斷點(diǎn)需要被忽略多少次才會(huì)中斷,若設(shè)置成5則表示第6次遇到該斷點(diǎn)時(shí)才觸發(fā)贮缕。
Action:設(shè)置斷點(diǎn)觸發(fā)時(shí)的動(dòng)作辙谜,可以為Debugger Command、Log Message感昼、Shell Command或Sound装哆。
例如可設(shè)置以下Debugger Command:
(1)讀取std::string sig的內(nèi)存buffer值:mem read sig.c_str() -c sig.size();
(2)打印NSData實(shí)例sig:po sig
(7)Debug
F6:下一步(Step Over)定嗓,逐過(guò)程單步調(diào)試蜕琴,不進(jìn)入函數(shù)體。
(fn+)F7:進(jìn)入(Step Into)函數(shù)體宵溅×杓颍可能與多媒體鍵有沖突,故需要fn輔助恃逻。
(fn+)F8:跳出(Step Out)函數(shù)體雏搂。可能與多媒體鍵有沖突寇损,例如呼叫iTunes凸郑,故需要fn輔助。
control+command+Y:逐斷點(diǎn)(continue)繼續(xù)執(zhí)行矛市。
trick:移動(dòng)指令指針(Move the instruction pointer):
斷點(diǎn)調(diào)試運(yùn)行時(shí)芙沥,可以將綠色指針箭頭(Line 47)移動(dòng)到其他行(Line 49)或其他斷點(diǎn)(Line 51)實(shí)現(xiàn)跳轉(zhuǎn)執(zhí)行。
(8)Watch
shift+command+M:Debug Workflow->View Memory。
command+K:Debug Workflow->Clear Console而昨。
Debug Workflow->ShowDisassembly When Debugging救氯,可進(jìn)行匯編指令級(jí)調(diào)試。
trick:修改變量?jī)?nèi)存值(change memory value while debugging):
調(diào)試運(yùn)行時(shí)配紫,可以在底部的調(diào)試窗口(Debug Area,可通過(guò)Shift+Command+Y呼出)右鍵某個(gè)變量午阵,除了可以進(jìn)行View Memory/View Value As之外躺孝,還可以選擇Edit Value運(yùn)行時(shí)編輯內(nèi)存變量的值。
這種手動(dòng)設(shè)置指定值底桂,在調(diào)試某些難以復(fù)現(xiàn)的bug或進(jìn)行邊界測(cè)試非常有用植袍,可以避免在驗(yàn)證某個(gè)問(wèn)題時(shí)反復(fù)改值重新編譯。
(9)lldb調(diào)試命令:
n/next:step over籽懦;
s/step:step into于个;
finish:step out;
c/continue:goto next breakpoint暮顺;
expr/expression:Evaluate a C/ObjC/C++ expression(動(dòng)態(tài)執(zhí)行C/ObjC/C++表達(dá)式)厅篓;
p/print/expr/expression:print as a C/C++ basic variable;
po/expr -O/expression -O:Print as an Objective-C object捶码;
call:調(diào)用羽氮。其實(shí)上述p/po后接表達(dá)式(expression)也有調(diào)用的功能,一般只在不需要顯式輸出惫恼,或是無(wú)返回值時(shí)使用call档押,用于動(dòng)態(tài)調(diào)試插入調(diào)用代碼。
例如可以在viewDidLoad:里面設(shè)置斷點(diǎn)祈纯,然后在程序中斷的時(shí)候輸入以下命令:
1
call?[self.view?setBackgroundColor:[UIColor?redColor]]
繼續(xù)運(yùn)行程序令宿,view的背景顏色將變成紅色!
bt(backtrace)腕窥,打印當(dāng)前調(diào)用堆棧(crash堆棧)粒没,“bt all”可打印所有thread的堆棧(相當(dāng)于command+6的Debug Session Navigation)。
image:可用于尋址簇爆,有多個(gè)組合命令革娄,比較實(shí)用的一種用法是尋找棧地址對(duì)應(yīng)的代碼(行)位置。
例如某個(gè)UITableView總共有2個(gè)section冕碟,當(dāng)其引用的currentSection.index≥2時(shí)將會(huì)引起[UITableView rectForHeaderInSection:]調(diào)用異常拦惋,可使用expr動(dòng)態(tài)改值制造crash場(chǎng)景模擬調(diào)試。
此時(shí)crash時(shí)的控制臺(tái)bt顯示異常出現(xiàn)在應(yīng)用層代碼“0x00d055b8 - [FACategoryTableView FACategorySectionHeaderDidTouched:] + 744”處(其中0x00d055b8為當(dāng)前棧(代碼段)偏移量安寺,744為棧幀偏移量——PC指針相對(duì)函數(shù)入口的偏移)厕妖。
那么具體是FACategoryTableView.m文件哪一行代碼調(diào)用引起的異常呢?此時(shí)通過(guò)“image lookup --address”后接bt的call stack中的代碼段偏移地址(0x00d055b8)即可定位出異常調(diào)用的代碼行位置挑庶。
x/memory read:dump指定地址的內(nèi)存(Read from the memory of the process being debugged)言秸,后接起止地址或-c指定count加起始地址软能。可help mem read查看幫助:
Syntax:
memory read[]
Command Options Usage:
size指定內(nèi)存塊(block/item)的大小举畸,默認(rèn)為1byte查排。
--size):The size in bytes to use when displaying with the selected format.
count指定內(nèi)存塊(block/item)的個(gè)數(shù),可配合起始地址使用抄沮。
-c( --count):The number of total items to display.
format指定內(nèi)容顯示格式跋核,格式符同print:c-char,s-string叛买,d-decimal砂代,x-hex。
-f( --format):Specify a format to be used for display.
Command Samples:
(a)起止地址
(lldb)mem read 0x10b88f0c 0x10b88f0c+9
0x10b88f0c: 39 38 37 36 35 34 33 32 31 ? ? ? ? ? ? ? ? ? ? ? 987654321
(b)起始地址+內(nèi)存塊count
(lldb)mem read 0x10b88f0c -c 9
0x10b88f0c: 39 38 37 36 35 34 33 32 31 ? ? ? ? ? ? ? ? ? ? ? 987654321
(c)起始地址+內(nèi)存塊size+內(nèi)存塊count(dump hex format)
(lldb)memory read -s 1 -f x -c 9 0x10b88f0c
0x10b88f0c: 0x39 0x38 0x37 0x36 0x35 0x34 0x33 0x32
0x10b88f14: 0x31
(d)起始地址+內(nèi)存塊size+內(nèi)存塊count(dump char format)
(lldb)memory read -s 1 -f c -c 9 0x10b88f0c
0x10b88f0c: 987654321
(e)起始地址+內(nèi)存塊size+內(nèi)存塊count(dump string format)
(lldb)mem read 0x10b5cf2c -f s -c 1
0x10b88f0c: "987654321"
(f)起始地址+內(nèi)存塊size+內(nèi)存塊count(dump int format)
(lldb)memory read -s 4 -f x -c 3 0x10b88f0c
0x10b88f0c: 0x36373839 0x32333435 0x109f0031
memory write:改寫(xiě)指定地址的內(nèi)存(Write to the memory of the process being debugged)率挣】桃粒可help mem write查看幫助:
Syntax: memory write
[[...]]
(10)啟用NSZombieEnabled調(diào)試EXC_BAD_ACCESS
當(dāng)你對(duì)已釋放的對(duì)象發(fā)送消息(90%的可能是對(duì)引用計(jì)數(shù)為0的對(duì)象再release)或release那些autorelease對(duì)象時(shí),就會(huì)出現(xiàn)報(bào)EXC_BAD_ACCESS這樣的錯(cuò)誤椒功。
默認(rèn)設(shè)置下 Xcode不會(huì)給你定位具體是哪一行代碼不該去使用已釋放的對(duì)象捶箱,或者release用錯(cuò)了。
Product -> Edit Scheme(option+command+R) -> Diagnostics 动漾,勾選“Objective-C”之后的“Enable Zombie Objects”讼呢。
設(shè)置NSZombieEnabled環(huán)境變量后,一個(gè)對(duì)象銷毀時(shí)會(huì)被轉(zhuǎn)化為_(kāi)NSZombie谦炬;設(shè)置NSZombieEnabled后悦屏,當(dāng)你向一個(gè)已經(jīng)釋放的對(duì)象發(fā)送消息,這個(gè)對(duì)象就不只是報(bào)EXC_BAD_ACCESS Crash键思,還會(huì)放出一個(gè)錯(cuò)誤消息础爬,然后以一種可預(yù)測(cè)的可以產(chǎn)生debug斷點(diǎn)的方式消失, 因此我們可以找到具體或者大概是哪個(gè)對(duì)象被錯(cuò)誤的釋放或引用了吼鳞。
注意:NSZombieEnabled只能在調(diào)試的時(shí)候使用看蚜,千萬(wàn)不要忘記在產(chǎn)品發(fā)布的時(shí)候去掉,因?yàn)镹SZombieEnabled不會(huì)真正去釋放dealloc對(duì)象的內(nèi)存赔桌,一直開(kāi)啟后果自負(fù)