Contents xvii
The LLDB Console ............................................................. 344
NSZombieEnabled Flag .......................................................348
Different Types of Crashes ..................................................... 348
Collecting Crash Reports ......................................................352
Third-Party Crash Reporting Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Summary .....................................................................354
Further Reading ...............................................................354
Chapter 20 Performance Tuning Until It Flies ............................. 357
The Performance Mindset .....................................................357
Welcome to Instruments ...................................................... 358
Finding Memory Problems ....................................................360
Finding CPU Problems ........................................................364
Drawing Performance .........................................................368
Optimizing Disk and Network Access ..........................................371
Summary .....................................................................371
Further Reading ...............................................................372
Part IV: Pushing the Limits ................................... 373
Chapter 21 Storyboards and Custom Transitions ......................... 375
Getting Started with Storyboards ..............................................375
Custom Transitions ............................................................380
Customizing Your Views Using UIAppearance Protocol .........................382
Summary .....................................................................383
Further Reading ...............................................................383
Chapter 22 Cocoa’s Biggest Trick: Key-Value Coding and Observing ....... 385
Key-Value Coding .............................................................385
Key-Value Observing ..........................................................395
KVO Tradeoffs .................................................................399
Summary .....................................................................400
Further Reading ...............................................................401
Chapter 23 Think Different: Blocks and Functional Programming ......... 403
What Is a Block? ...............................................................403
Declaring a Block ..............................................................406
Implementing a Block .........................................................408
Blocks and Concurrency .......................................................410
Block-Based Cocoa Methods ...................................................412
Supported Platforms ..........................................................415
Summary .....................................................................415
Further Reading ...............................................................415
Chapter 24 Going Offline................................................ 417
Reasons for Going Offline .....................................................417
Strategies for Caching ......................................................... 418
Data Model Cache. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
Cache Versioning .............................................................426
Creating an In-Memory Cache .................................................427
Creating a URL Cache .........................................................431
Summary .....................................................................433
Further Reading ...............................................................433
Chapter 25 Data in the Cloud............................................ 435
iCloud ........................................................................435
Third-Party Cloud Offerings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Parse .........................................................................438
StackMob ..................................................................... 442
Disadvantages of Using a Backend as a Service ................................. 444
Summary .....................................................................444
Further Reading ...............................................................444
Chapter 26 Fancy Text Layout ........................................... 447
The Normal Stuff: Fields, Views, and Labels .....................................447
Rich Text in UIKit ..............................................................448
Web Views for Rich Text .......................................................453
Core Text .....................................................................454
Summary .....................................................................464
Further Reading ...............................................................464
Chapter 27 Building a (Core) Foundation ................................. 465
Core Foundation Types ........................................................465
Naming and Memory Management ............................................466
Allocators ..................................................................... 467
Introspection .................................................................468
Strings and Data .............................................................. 469
Collections ....................................................................474