Step into Xcode: Mac OS X Development
暫譯: 進入 Xcode:Mac OS X 開發

Fritz Anderson

買這商品的人也買了...

相關主題

商品描述

Description:

A Step-by-Step Guide to the Xcode Mac OS Development Environment

Every copy of Mac OS X comes with Xcode, the powerful development suite that Apple uses to build applications ranging from Safari to iTunes. But because Xcode is complex and subtle, even experienced Mac programmers rarely take full advantage of it. Now, Mac developer Fritz Anderson has written the definitive introduction and guide to using Xcode to build applications with any Macintosh technology or language.

Anderson helps you master Xcode's powerful text editor, industry-standard gcc compiler, graphical interactive debugger, mature UI layout and object linkage editor, and exceptional optimization tools. One step at a time, you'll develop a command-line utility, then use Xcode tools to evolve it into a full-fledged Cocoa application. Anderson provides expert guidance on development frameworks, source code management, Core Data modeling, localization, and much more.

Coverage includes

  • Understanding Xcode workflow and the Mac OS X application lifecycle
  • Porting established legacy projects into Xcode
  • Using the Model-View-Controller design pattern to build robust graphical applications
  • Building static libraries and working with Xcode's build system
  • Making the most of bundles and package directories
  • Creating applications compatible with older versions of Mac OS X
  • Creating universal binaries to run on both Intel and PowerPC Macintoshes
  • Adding Spotlight searchability to data files
  • Leveraging Xcode's built-in support for unit testing
  • Using Xcode on makefile-based UNIX development projects

Step Into Xcode's breadth, depth, and practical focus make it indispensable to every Mac developer: current Xcode users upgrading to Xcode 2.1, experienced Mac programmers migrating from CodeWarrior, UNIX/Linux programmers moving to Mac OS X, and even novices writing their first programs or scripts.

 

Table of Contents:

Preface xvii
Part I The Life Cycle of a Mac OS X Application 1
1 Kicking the Tires 3
1.1 First Run 3

1.2 Hello, World 4

1.3 What Went Where 9

1.4 Summary 10

2 Simple Workflow and Passive Debugging 11
2.1 Linear Regression 11

2.2 Plan of Action 13

2.3 A Command Line Tool 14

2.4 Build Errors 15

2.5 Simple Debugging 18

2.6 Summary 21

3 Simple Active Debugging 23
3.1 The Next Step 23

3.2 Active Debugging 24

3.3 Summary 31

4 Compilation: The Basics 33
4.1 Compiling 33

4.2 Linking 36

4.3 Dynamic Loading 38

4.4 Prebinding 39

4.5 ZeroLink 40

4.6 Summary 42

5 Starting a Cocoa Application 43
5.1 Plan of Action 43

5.1.1 Program Tasks 43

5.1.2 Model-View-Controller 43

5.2 Starting a New Project 48

5.3 Implementation: Model 50

5.3.1 DataPoint 50

5.3.2 RegressionModel Class 54

5.3.3 Model: Done 58

5.4 Summary 60

6 A Cocoa Application: Views 61
6.1 Interface Builder 62

6.2 Layout 63

6.3 Sizing 67

6.4 A Split View 71

6.5 Summary 71

7 A Cocoa Application: Controllers 73
7.1 Still in Interface Builder 73

7.2 NSObjectController: Document 75

7.3 NSObjectController: Model 77

7.4 NSArrayController: DataPoints 78

7.5 Value Binding 80

7.6 Actions and Outlets 81

7.7 MyDocument 82

7.8 Application Properties 84

7.9 Building 87

7.10 Summary 87

8 Property Lists 89
8.1 Data Types 89

8.2 Property List Files 90

8.2.1 Writing a Property List 90

8.2.2 Examining Property Lists 100

8.3 Other Formats 106

8.3.1 ASCII Property Lists 106

8.3.2 Binary Property Lists 107

8.4 Text Macros 107

8.5 Summary 113

9 Libraries and Dependent Targets 115
9.1 Adding a Target 115

9.2 Library Design 116

9.3 Modifying Linear 121

9.4 A Dependent Target 123

9.5 Examining the Library 125

9.6 Running the Library 127

9.7 Summary 128

10 File Packages and Bundles 129
10.1 A Simple Package: RTFD 130

10.2 Bundles 132

10.3 Application Bundles 132

10.4 The Info.plist File 134

10.4.1 Keys for All Bundles 135

10.4.2 Keys for Applications 136

10.4.3 Keys for Plug-Ins 138

10.4.4 Keys for Java 139

10.4.5 Keys for Preference Panes 139

10.4.6 Keys for Dashboard Widgets 139

10.5 Summary 140

11 Creating a Custom View 141
11.1 Controller 141

11.2 View 143

11.3 The Delegate Design Pattern 146

11.4 The Custom View 149

11.5 Showing the Window 156

11.6 Testing 157

11.7 Debugging a View 159

11.8 Summary 163

12 Dynamic Libraries and Frameworks 165
12.1 Adding a Framework Target 166

12.2 Framework Structure 171

12.3 Using the Framework 173

12.4 Where Frameworks Go 175

12.5 Private Frameworks 179

12.6 Prebinding 181

12.7 Summary 182

13 Version Control 183
13.1 Setting up a Repository 185

13.2 Controlling Linear 191

13.3 Long Live Linear 194

13.4 Tagging 195

13.5 Summary 198

14 Cross-Development 199
14.1 Cross-Development SDKs 199

14.2 Nib Compatibility 203

14.3 NSTableDataSource 205

14.4 Add, Remove, Compute, and Graph Buttons 208

14.5 Run and Archive 211

14.6 A More Sophisticated Approach 212

14.7 Producing a Universal Binary 212

14.7.1 Auditing for Portability 213

14.7.2 Auditing Linear 214

14.7.3 Building Universal 217

14.7.4 Mixing SDKs 218

14.8 Summary 219

15 Using the Data Modeling Tools 221
15.1 Data Modeling 221

15.2 Revisiting the Model 224

15.2.1 DataPoint 225

15.2.2 Regression 228

15.2.3 MyDocument 232

15.3 Interface Builder 234

15.4 Build and Run 235

15.5 Adding an Entity 237

15.5.1 Adding to the Data Model 237

15.5.2 Human Interface 238

15.5.3 First Run 240

15.5.4 One More Table 241

15.6 Summary 242

16 Spotlight 243
16.1 How Data Gets into Spotlight 243

16.2 Uniform Type Identifiers 246

16.3 The Metadata Plug-In 249

16.3.1 MetaLinear Project Files 249

16.3.2 Packaging the Plug-In 254

16.4 Core Data and Metadata 254

16.5 The Proof of the Pudding 258

16.6 Summary 261

17 Finishing Touches 263
17.2 Avoiding Singularity 264

17.3 Localization 266

17.3.1 Credits.rtf 266

17.3.2 MainMenu.nib 267

17.3.3 MyDocument.nib 267

17.3.4 GraphWindow.nib 269

17.3.5 InfoPlist.strings 270

17.3.6 Trying It Out 271

17.3.7 Localizable.strings 272

17.4 Checking Memory Usage 274

17.5 The Release Build Configuration 276

17.6 Dead-Code Stripping 278

17.7 xcodebuild 279

17.8 Summary 281

Part II Xcode Tasks 283
18 Navigating an Xcode Project 285
18.1 Editor Panes 285

18.1.1 Jumps 285

18.1.2 Code Sense 286

18.1.3 Navigation Bar 287

18.1.4 Editor Modes 289

18.2 Project Find Window 290

18.3 The Favorites Bar 291

18.4 Groups & Files List 292

18.4.1 The Project Group 292

18.4.2 The Targets Group 294

18.4.3 The Executables Group 296

18.4.4 Smart Groups 297

18.4.5 Symbol Smart Group 298

18.5 Class Browser Window 299

18.6 Class Modeler 299

18.7 Project Layout 302

18.7.1 Default Layout 302

18.7.2 All-in-One Layout 303

18.7.3 Condensed Layout 305

18.8 Summary 306

19 Xcode for CodeWarrior Veterans 307
19.1 Losses 307

19.1.1 Speed 307

19.1.2 Syntax Coloring 308

19.1.3 Debugging Templates 308

19.1.4 RAD Tools 309

19.2 Make Yourself at Home 309

19.2.1 The Project Window 309

19.2.2 Key Mapping 311

19.2.3 Build Behavior 312

19.2.4 Window Behavior 313

19.3 Converting a CodeWarrior Project 314

19.3.1 Importing the Project 315

19.3.2 Targets and Configurations 315

19.4 Traps in Conversion 319

19.5 Exporting Symbols 320

19.5.1 #pragma export 320

19.5.2 Another Way 322

19.6 Summary 323

20 Xcode for make Veterans 325
20.1 Xcode Build Variables 327

20.2 Custom Build Rules 328

20.3 Run Script Build Phase 330

20.4 Under the Hood: A Simple Build 331

20.4.1 Copy Structural Files 332

20.4.2 Copy Bundle Resources 333

20.4.3 Compile Sources 333

20.4.4 Linkage (First Architecture) 336

20.4.5 Compile Sources (Second Architecture) 336

20.4.6 Linkage (Second Architecture) 337

20.4.7 Create Universal Binary 337

20.4.8 Compile Data Models 338

20.4.9 Finishing Touch 339

20.5 The xcode build Tool 339

20.6 Settings Hierarchy 340

20.7 Build Configurations 342

20.8 Summary 344

21 More About Debugging 345
21.1 Debugging Techniques 345

21.2 Printing Values 348

21.3 Custom Formatters 349

21.4 Breakpoint Commands 352

21.5 Breakpoint Conditions 354

21.6 Lazy Symbol Loading 355

21.7 Zombies 356

21.7.1 Released-Pointer Aliasing 357

21.7.2 Zombies in Cocoa 359

21.7.3 Zombies in Core Foundation 360

21.8 Summary 361

22 Xcode and Speed 363
22.1 Precompiled Headers 363

22.2 Predictive Compilation 364

22.3 Distributed Builds 365

22.4 ZeroLink 366

22.5 Profect Indexing 367

22.6 Summary 368

23 AppleScript Studio 369
23.1 An AppleScript Application 369

23.2 Unit Testing 377

23.2.1 Adding OC Unit 378

23.2.2 Test Cases 379

23.2.3 Testing Options 383

23.3 Summary 383

24 A Large Project 385
24.1 Graphviz 386

24.2 Preparing the Project 386

24.3 An External Build Project 389

24.4 Debugging a Custom Executable 393

24.5 Performance 396

24.6 A Better Way to Include Files 400

24.6.1 The Script 401

24.6.2 Building the Project Index 404

24.6.3 Compromising with AppleScript 405

24.7 Summary 405

25 Closing Snippets 407
25.1 Miscellaneous Traps 407

25.2 Miscellaneous Tips 409

25.3 Documentation 413

25.3.1 The Documentation Window 414

25.3.2 Documentation Updates 416

Appendix A Installing Xcode 417
A.1 Apple Developer Connection 419

A.1.1 Downloading from ADC 420

A.2 Setting up the Dock 420

Appendix B Some Build Variables 423
B.1 Useful Build Variables 423

B.2 Splitting Build Variables 429

B.3 Source Trees 430

Glossary 433
Index 441

商品描述(中文翻譯)

**描述:**

**逐步指南:Xcode Mac OS 開發環境**

每一份 Mac OS X 都附帶 Xcode,這是 Apple 用來構建從 Safari 到 iTunes 等應用程序的強大開發套件。但由於 Xcode 複雜且微妙,即使是經驗豐富的 Mac 程式設計師也很少能充分利用它。現在,Mac 開發者 Fritz Anderson 撰寫了使用 Xcode 構建任何 Macintosh 技術或語言應用程序的權威介紹和指南。

Anderson 幫助你掌握 Xcode 的強大文本編輯器、行業標準的 gcc 編譯器、圖形互動調試器、成熟的 UI 佈局和物件鏈接編輯器,以及卓越的優化工具。一步一步地,你將開發一個命令行工具,然後使用 Xcode 工具將其演變為一個完整的 Cocoa 應用程序。Anderson 提供了有關開發框架、源代碼管理、Core Data 建模、本地化等方面的專業指導。

涵蓋內容包括:
- 理解 Xcode 工作流程和 Mac OS X 應用程序生命週期
- 將既有的舊項目移植到 Xcode
- 使用模型-視圖-控制器設計模式構建穩健的圖形應用程序
- 構建靜態庫並使用 Xcode 的構建系統
- 充分利用捆綁包和包目錄
- 創建與舊版本 Mac OS X 兼容的應用程序
- 創建可在 Intel 和 PowerPC Macintosh 上運行的通用二進制文件
- 為數據文件添加 Spotlight 搜索功能
- 利用 Xcode 內建的單元測試支持
- 在基於 makefile 的 UNIX 開發項目中使用 Xcode

《步入 Xcode》的廣度、深度和實用性使其對每位 Mac 開發者不可或缺:當前的 Xcode 用戶升級到 Xcode 2.1、經驗豐富的 Mac 程式設計師從 CodeWarrior 遷移、UNIX/Linux 程式設計師轉向 Mac OS X,甚至是撰寫第一個程序或腳本的新手。

**目錄:**

前言 xvii
第一部分 Mac OS X 應用程序的生命週期 1
1 開始探索 3
1.1 首次運行 3
1.2 你好,世界 4
1.3 什麼去向何處 9
1.4 總結 10
2 簡單工作流程和被動調試 11
2.1 線性回歸 11
2.2 行動計劃 13
2.3 一個命令行工具 14
2.4 構建錯誤 15
2.5 簡單調試 18
2.6 總結 21
3 簡單主動調試 23
3.1 下一步 23
3.2 主動調試 24
3.3 總結 31
4 編譯:基礎 33
4.1 編譯 33
4.2 連結 36
4.3 動態加載 38
4.4 預綁定 39
4.5 ZeroLink 40
4.6 總結 42
5 開始一個 Cocoa 應用程序 43
5.1 行動計劃 43
5.1.1 程序任務 43
5.1.2 模型-視圖-控制器 43
5.2 開始一個新項目 48
5.3 實現:模型 50
5.3.1 DataPoint 50
5.3.2 RegressionModel 類 54
5.3.3 模型:完成 58
5.4 總結 60
6 一個 Cocoa 應用程序:視圖 61
6.1 介面建構器 62
6.2 佈局 63
6.3 尺寸 67
6.4 分割視圖 71
6.5 總結 71
7 一個 Cocoa 應用程序:控制器 73
7.1 仍在介面建構器中 73
7.2 NSObjectController:文檔 75
7.3 NSObjectController:模型 77
7.4 NSArrayController:數據點 78
7.5 值綁定 80
7.6 行動和插座 81
7.7 MyDocument 82
7.8 應用程序屬性 84
7.9 構建 87
7.10 總結 87
8 屬性列表 89
8.1 數據類型 89
8.2 屬性列表文件 90
8.2.1 編寫屬性列表 90
8.2.2 檢查屬性列表 100
8.3 其他格式 106
8.3.1 ASCII 屬性列表 106
8.3.2 二進制屬性列表 107
8.4 文本宏 107
8.5 總結 113
9 庫和依賴目標 115
9.1 添加目標 115
9.2 庫設計 116
9.3 修改線性 121
9.4 依賴目標 123
9.5 檢查庫 125
9.6 運行庫 127
9.7 總結 128
10 文件包和捆綁包 129
10.1 一個簡單的包:RTFD 130
10.2 捆綁包 132
10.3 應用程序捆綁包 132
10.4 Info.plist 文件 134
10.4.1 所有捆綁包的鍵 135
10.4.2 應用程序的鍵 136
10.4.3 插件的鍵 138
10.4.4 Java 的鍵 139
10.4.5 偏好面板的鍵 139
10.4.6 儀表板小部件的鍵 139
10.5 總結 140
11 創建自定義視圖 141
11.1 控制器 141
11.2 視圖 143
11.3 委託設計模式 146
11.4 自定義視圖 149
11.5 顯示窗口 156
11.6 測試 157
11.7 調試視圖 159
11.8 總結 163
12 動態庫和框架 165
12.1 添加框架目標 166
12.2 框架結構 171
12.3 使用框架 173
12.4 框架的位置 175
12.5 私有框架 179
12.6 預綁定 181
12.7 總結 182
13 版本控制 183
13.1 設置倉庫 185
13.2 控制線性 191
13.3 長壽線性 194
13.4 標記 195
13.5 總結 198
14 跨開發 199
14.1 跨開發 SDK 199
14.2 Nib 兼容性 203
14.3 NSTableDataSource 205
14.4 添加、刪除、計算和圖形按鈕 208
14.5 運行和存檔 211
14.6 更複雜的方法 212
14.7 生成通用二進制文件 212
14.7.1 可攜性審核 213
14.7.2 審核線性 214
14.7.3 構建通用 217
14.7.4 混合 SDK 218
14.8 總結 219
15 使用數據建模工具 221
15.1 數據建模 221
15.2 重新檢視模型 224
15.2.1 DataPoint 225
15.2.2 回歸 228
15.2.3 MyDocument 232
15.3 介面建構器 234
15.4 構建和運行 235
15.5 添加實體 237
15.5.1 添加到數據模型 237
15.5.2 人機介面 238
15.5.3 首次運行 240
15.5.4 再一個表格 241
15.6 總結 242
16 Spotlight 243
16.1 數據如何進入 Spotlight 243
16.2 統一類型標識符 246
16.3 元數據插件 249
16.3.1 MetaLinear 項目文件 249