Sams Teach Yourself
Xcode 4
in 24 Hours
John Ray
William Ray
800 East 96th Street, Indianapolis, Indiana, 46240 USA
Sams Teach Yourself Xcode 4 in 24 Hours
Copyright 2012 by Pearson Education, Inc.
All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein.
ISBN-13: 978-0-672-33587-7
ISBN-10: 0-672-33587-5
The Library of Congress Cataloging-in-Publication data is on file.
Printed in the United States of America
First Printing June 2012
Editor-in-Chief
Greg Wiegand
Acquisitions Editor
Laura Norman
Development Editor
Keith Cline
Managing Editor
Kristy Hart
Project Editor
Andy Beaster
Copy Editor
Keith Cline
Indexer
Tim Wright
Proofreader
Chrissy White
Technical Editor
Greg Kettell
Publishing Coordinator
Cindy Teeters
Book Designer
Gary Adair
Compositor
Nonie Ratcliff
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an as is basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book.
Bulk Sales
Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales. For more information, please contact
U.S. Corporate and Government Sales
1-800-382-3419
For sales outside of the U.S., please contact
International Sales
About the Authors
John Ray is currently serving as a Senior Business Analyst and Development Team Manager for the Ohio State University Office of Research. He has written numerous books for Macmillan/Sams/Que, including Using TCP/IP: Special Edition, Teach Yourself Dreamweaver MX in 21 Days, Mac OS X Unleashed, and Teach Yourself iOS 5 Development in 24 Hours. As a Macintosh user since 1984, he strives to ensure that each project presents the Macintosh with the equality and depth it deserves. Even technical titles such as Using TCP/IP contain extensive information about the Macintosh and its applications and have garnered numerous positive reviews for their straightforward approach and accessibility to beginner and intermediate audiences.
Will Ray is an assistant professor of pediatrics in the Battelle Center for Mathematical Medicine at Nationwide Childrens Hospital. Trained as a biophysicist in computational biology and scientific visualization, Dr. Rays group is working to bring cutting-edge computational technology to end users, through simplified user interfaces. He has been developing training materials and teaching users and programmers to live at the intersection of Macintosh and UNIX technologies since 1989.
You can visit their Xcode book website at http://teachyourselfxcode.com or follow their book-related tweets on Twitter at #XcodeIn24.
Dedication
Since Will and I couldnt agree on dedicating this to his parents or mine, we hereby dedicate this book to the game #Starhawk. Come play the authors and discuss Xcode in the regularly appearing Old-N-Slow server.
Acknowledgments
Thank you to the group at Sams PublishingLaura Norman, Keith Cline, Greg Kettellfor working through the table of content changes, schedule conflicts, and on-the-fly revisions. Youve made this book a reality and deciphered many 2 a.m. sentences that were barely more than random keyboard mashing.
Thanks to everyone around usfamily, friends, distant relations, strangers, and petsfor providing food, ibuprofen, and paying the bills.
We Want to Hear from You!
As the reader of this book, you are our most important critic and commentator. We value your opinion and want to know what were doing right, what we could do better, what areas youd like to see us publish in, and any other words of wisdom youre willing to pass our way.
You can e-mail or write me directly to let me know what you did or didnt like about this bookas well as what we can do to make our books stronger.
Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message.
When you write, please be sure to include this books title and author as well as your name and phone number or e-mail address. I will carefully review your comments and share them with the author and editors who worked on the book.
E-mail:
Mail: Greg Wiegand
Editor-in-Chief
Sams Publishing
800 East 96th Street
Indianapolis, IN 46240 USA
Reader Services
Visit our website and register this book at informit.com/register for convenient access to any updates, downloads, and errata that might be available for this book.
Introduction
So youve decided to write applications for OS X or iOS. You sit down at your Macintosh, start up Xcode, and... what? Create a project? Create a file? Make a storyboard? Build a Core Data model? What?
For an operating system that prides itself on being accessible to many, Xcode can appear as an insurmountable obstacle to an unprepared developer. With an iTunes-like interface, and more panels, palettes, menus, and buttons than you can count, even a simple Hello World application can seem daunting. Apple, while diligent in providing documentation, provides very few resources for developers who understand programming fundamentals but not their OS X/iOS implementation. Thats where this book comes in.
Xcode offers a range of integrated tools for everything from data modeling to performance analysis and optimization. Teach Yourself Xcode in 24 Hours takes 24 of the most important aspects of Xcode development and condenses them down into easily understandable chunks. To help convey some of the core concepts, you work with real projects for both iOS and OS X that demonstrate important features such as shared libraries/frameworks, storyboards, Core Data models, and even hands-on debugger practice.
Xcode 4 represents an entirely redesigned version of Apples development suite. Despite reaching version 4.4 (in beta) during this writing, it has only been in developers hands for slightly more than a year. Unfortunately, this means it is a still a bit rough around the edges. We point out the issues where we encounter them, but dont be shy about filing bug reports with Apple if features dont quite work as anticipated. With the help of the OS X/iOS community, Xcode is being improved and enhanced rapidly. Each new release brings more consistency and reliability to the product.