Learn Objective-C on the Mac

By Scott Knaster , Mark Dalrymple

Take your coding skills to the next level with this extensive guide to Objective-C, the native programming language for developing sophisticated software applications for Mac OS X.

Full Description

  • ISBN13: 978-1-4302-1815-9
  • 360 Pages
  • User Level: Beginner to Advanced
  • Publication Date: January 6, 2009
  • Available eBook Formats: EPUB, MOBI, PDF
  • Print Book Price: $39.99
  • eBook Price: $27.99
Buy eBook Buy Print Book Add to Wishlist

Related Titles

Full Description

Take your coding skills to the next level with this extensive guide to Objective–C, the native programming language for developing sophisticated software applications for Mac OS X. Objective–C is a powerful, object–oriented extension of C, making this book the perfect follow–up to Dave Mark’s bestselling Learn C on the Mac, Mac OS X Edition. Whether you’re an experienced C programmer or you’re coming from a different language such as C++ or Java, leading Mac experts Mark Dalrymple and Scott Knaster show you how to harness the powers of Objective–C in your applications!

  • A complete course on the basics of Objective–C using Apple’s free Xcode tools
  • An introduction to object–oriented programming
  • Comprehensive coverage of inheritance, composition, object initialization, categories, protocols, memory management, and organizing source files
  • A brief tour of Cocoa’s foundation framework and AppKit
  • A helpful “learning curve” guide for non–C developers

What you’ll learn

  • Learn Objective–C programming, the gateway to programming your Mac or iPhone
  • Write applications for the Mac OS X interface, the cleanest user–interface around
  • Understand variables and how to design your own data structures
  • Work with the file system
  • Connect to data sources and the Internet

Who this book is for

For anyone wanting to learn to program native applications in Mac OS X, including developers new to the Mac, developers new to Objective–C, or students entirely new to programming.

Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.

Errata

Please Login to submit errata.

On page Chapt 3 - Starting with Shapes-Object-1:

Problem building sample code when starting with XCode 4.2 new project.

System - MacBook Pro - Spring 2011

Mac OS X Lion 10.7.2 (11C74)
XCode 4.2 (4D199)
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)


Project Build Settings
Under Apple LLVM compiler 3.0 Language
Objective-C Automatic Reference Counting defaults to "Yes" for new projects
shows up as: CLANG_ENABLE_OBJC_ARC
Must be set to no for successful build, resulting in the following option set for the project.
CLANG_ENABLE_OBJC_ARC = NO

If not, the following errors result and the project build fails.


/Users/terje/devel/learnobjectiveC_24x7/Shaped-Object/Shapes-Object/main.m:33:11: warning: no previous prototype for function 'colorName' [-Wmissing-prototypes,3]

/Users/terje/devel/learnobjectiveC_24x7/Shaped-Object/Shapes-Object/main.m:187:21:{187:18-187:29}: error: must explicitly describe intended ownership of an object array parameter [4]

/Users/terje/devel/learnobjectiveC_24x7/Shaped-Object/Shapes-Object/main.m:187:6: warning: no previous prototype for function 'drawShapes' [-Wmissing-prototypes,3]

/Users/terje/devel/learnobjectiveC_24x7/Shaped-Object/Shapes-Object/main.m:222:14:{222:14-222:20}: error: passing '__strong id *' to parameter of type '__unsafe_unretained id *' changes retain/release properties of pointer [3]

33: NSString *colorName (ShapeColor color)
187: void drawShapes (id shapes[], int count)
222: drawShapes (shapes, 3);

Loading the downloaded XCode project works fine after changing the SDK to SnowLeopard (10.6.x) or Lion (10.7.x)

The warnings regarding missing prototypes can be eliminated by modifying the warnings settings:
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO


On page 1:

The downloads are based on SDK Mac OS X 10.5. The current version of Xcode returns and error message "The run destination My Mac 64-bit is not valid for Running the scheme '03.02 Count-2'." For each program you need to change the validate setting so you can run the programs. Probably it is worth mentioning in the starting chapter. I found it out in user forums how to change others may just put the book aside.

On page 187:
[engine release]; is not shown on the updated version of main().

It does appear when its being explains line by line on page 188, but it does not appear in the full version on 187.

You did not release! Bad memory management!

Great book so far! Thanks.

Nadav