Xcode 5
Published by
John Wiley & Sons, Inc.
10475 Crosspoint Blvd.
Indianapolis, IN 46256
www.wiley.com
Copyright 2014 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-118-83433-6
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, 201-748-6011, fax 201-748-6008, or online at http://www.wiley.com/go/permissions .
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S. at (877) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.
Library of Congress Control Number: 2013956856
Trademarks: Wiley and the Wiley logo are registered trademarks of John Wiley & Sons, Inc., in the United States and other countries, and may not be used without written permission. Xcode is a registered trademark of Apple, Inc. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com . For more information about Wiley products, visit www.wiley.com .
For Jan
About the Author
Richard Wentk is one of the U.K.s most reliable technology writers, with more than ten years of experience as a developer and more than fifteen years in publishing. He covers Apple products and developments for Macworld and MacFormat magazines and writes about technology, creativity, and business strategy for titles such as Computer Arts and Future Music. As a trainer and former professional Apple developer returning now to development on the iPhone and OS X, he is uniquely able to clarify the key points of the development process, explain how to avoid pitfalls and bear traps, and emphasize key benefits and creative possibilities. He lives online but also has a home in Wiltshire, England. For details of apps and other book projects, visit www.zettaboom.com .
Credits
Acquisitions Editor
Aaron Black
Project Editor
Martin V. Minner
Technical Editor
Brad Miller
Copy Editor
Gwenette Gaddis
Director, Content Development & Assembly
Robyn Siesky
Vice President and Executive Group Publisher
Richard Swadley
Acknowledgments
Although book publishing has become digital, book writing hasn't. A book continues to be a team effort.
My thanks go to acquisitions editor Aaron Black for making the project happen and to project editor Martin V. Minner for his continuing support and extended patience. Sincere thanks are also due to the rest of the team at Wiley for their hard work behind the scenes, especially technical editor Brad Miller, whose feedback and comments were invaluable.
Personal gratitude is due to Annette, Alexa, and Hilary, who all contributed more than they know.
Software development has become a communal activity, and particular appreciation is due to the countless bloggers, experimenters, developers, and problem-solvers on the web whose generosity and creativity have made so much possible in so many ways.
Finally, love as always to Team HGA. I couldnt have written it without you.
Preface
Having become comfortable with Xcode 4, I was curious about the changes that Apple would make in Xcode 5. Some, such as the removal of the old GCC toolchain and its replacement with an all-LLVM compiler and debugger, were expected. Others, such as further simplification of the permission profiling and app submission process, were very welcome.
Xcode 5s designers have continued to simplify app development and make it more accessible to the public. There is no doubt that the App Store has been a phenomenal success, with millions of contributions from both professional and amateur developers. The latter have proven that Xcode works as intended. Starting with little or no software experience, they have developed and sold apps to an international market. Even if the quality is variable, the sheer number of apps proves that app development isnt quite the mystery it once was.
As Apple moves into new markets, the number of newcomers continues to grow. So the first goal of this book is to introduce the key features of Xcode 5 for those who are just getting started. Newcomers should begin at the front of the book and work their way through it in order. The sequence of the earlier chapters is designed to be a practical primer for Xcode development, not just a list of features and changes.
A second goal is to highlight important changes, and introduce some of the more complex features in more detail. Many newcomers use Xcode in a simple click-bang way, missing out on the power and flexibility hidden under the surface. The less-obvious features are easy to skip, but exploring them can open up new possibilities for testing, debugging, project management, and build control.
Some tools, such as Instruments, have further hidden layers of their own that would require a further book the size of this one to explore fully. Others, such as bots, are new in Xcode 5. Still others, including details of the build system, have been expanded in this edition, with extra notes about the challenges developers can encounter when trying to integrate code from projects built in other environments.