Thông tin tài liệu
Karl G. Kowalski
Learn to:
• Download the Mac App SDK and start
working with Xcode
®
• Take advantage of Mac desktop features
to create amazing apps
• Submit your app to the Mac App Store
and na
vigate the approval process
IN FULL COLOR!
Mac
®
Application Development
Making Everything Easier!
™
Open the book and find:
• The skills you’ll need to develop
Mac apps
• Where to find online assistance
• Sources and resources for a
Mac project
• Advice on testing a user interface
• How to use Model-View-Controller
• Ways to check your app for
memory leaks
• What Apple looks for in your app
• App development best practices
Karl G. Kowalski is the principal software engineer for RSA Security, where
he has worked on security software solutions for Apple devices since 2006.
He’s an expert Mac developer with experience in technologies ranging from
databases to text-to-speech integration.
Macintosh/Programming
$29.99 US / $35.99 CN / £21.99 UK
ISBN 978-1-118-03222-0
Go to Dummies.com
®
for videos, step-by-step examples,
how-to articles, or to shop!
Visit the companion website at www.
dummies.com/go/macapplication
development for valuable code samples
The Mac App Store is open for desktop business! You can get
in on the action with this easy-to-follow guide to developing a
Mac app from concept to completion. Here’s how to become
a registered Mac developer, plan an app that users will love,
work with Objective-C and code libraries, build and debug your
app, and market it through the App Store.
• Welcome to Mac land — learn about Mac apps in general, the tools
you need to start building them, and how to register as a Mac developer
• Learn the code — discover the basics of Objective-C
®
programming,
the Cocoa
®
Framework, and how to create a Mac app’s user interface
• It’s all about the user — learn strategies for supporting user
e
xpectations and how to create a positive user experience
• Information, please — safely manage and store the information
us
ers will provide
• The finishing touches — hunt down and banish the bugs and prepare
to a
ce Apple’s app review
Join the fun! Start developing
apps for the Mac desktop now —
this book shows you how!
In
Color
Mac
®
Application Development
Mac
®
Application Development
Kowalski
www.it-ebooks.info
Start with FREE Cheat Sheets
Cheat Sheets include
• Checklists
• Charts
• Common Instructions
• And Other Good Stuff!
Get Smart at Dummies.com
Dummies.com makes your life easier with 1,000s
of answers on everything from removing wallpaper
to using the latest version of Windows.
Check out our
• Videos
• Illustrated Articles
• Step-by-Step Instructions
Plus, each month you can win valuable prizes by entering
our Dummies.com sweepstakes. *
Want a weekly dose of Dummies? Sign up for Newsletters on
• Digital Photography
• Microsoft Windows & Office
• Personal Finance & Investing
• Health & Wellness
• Computing, iPods & Cell Phones
• eBay
• Internet
• Food, Home & Garden
Find out “HOW” at Dummies.com
*Sweepstakes not currently available in all countries; visit Dummies.com for official rules.
Get More and Do More at Dummies.com
®
To access the Cheat Sheet created specifically for this book, go to
www.dummies.com/cheatsheet/macapplicationdevelopment
Mobile Apps
There’s a Dummies App for This and That
With more than 200 million books in print and over 1,600 unique
titles, Dummies is a global leader in how-to information. Now
you can get the same great Dummies information in an App. With
topics such as Wine, Spanish, Digital Photography, Certification,
and more, you’ll have instant access to the topics you need to
know in a format you can trust.
To get information on all our Dummies apps, visit the following:
www.Dummies.com/go/mobile from your computer.
www.Dummies.com/go/iphone/apps from your phone.
www.it-ebooks.info
by Karl G. Kowalski
Mac
®
Application
Development
FOR
DUMmIES
‰
www.it-ebooks.info
Mac
®
Application Development For Dummies
®
Published by
John Wiley & Sons, Inc.
111 River Street
Hoboken, NJ 07030-5774
www.wiley.com
Copyright © 2012 by John Wiley & Sons, Inc., Hoboken, New Jersey
Published by John Wiley & Sons, Inc., Hoboken, New Jersey
Published simultaneously in Canada
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 permit-
ted 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.
Trademarks: Wiley, the Wiley logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!,
The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, Making Everything Easier,
and
related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its afliates
in the United States and other countries, and may not be used without written permission. Dragon
NaturallySpeaking is a registered trademark Nuance Communications, 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.
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 WITH-
OUT 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 FUR-
THER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFOR-
MATION 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, 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.
For technical support, please visit www.wiley.com/techsupport.
Wiley also publishes its books in a variety of electronic formats and by print-on-demand. Not all
content that is available in standard print versions of this book may appear or be packaged in all book
formats. If you have purchased a version of this book that did not include media that is referenced by or
accompanies a standard print version, you may request this media by visiting http://booksupport.
wiley.com. For more information about Wiley products, visit us www.wiley.com.
Library of Congress Control Number: 2011937927
ISBN: 978-1-118-03222-0 (pbk); ISBN: 978-1-118-15999-6 (ebk); ISBN: 978-1-118-16001-5 (ebk);
ISBN: 978-1-118-16002-2 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
www.it-ebooks.info
About the Author
Karl Kowalski has traveled the world of computers and software develop-
ment for far longer than he’s willing to admit. He has written programs for
airplanes, robots, games, and even particle accelerators, and he has devel-
oped software on platforms ranging from desktop computer to mainframes
and all the way down to smartphones. He is also the author of BlackBerry
Application Development For Dummies (John Wiley & Sons, Inc.). He lives
near Boston and works for RSA, the Security Division of EMC, where he
develops security solutions for mobile platforms such as BlackBerry and
iPhone, and desktop operating systems such as Windows and Mac OS X. In
his spare time, he develops software for smartphones as part of his startup,
BlazingApps LLC (www.blazingapps.com). And if there are any spare sec-
onds in the day, he does some voice-over work for one of his favorite jour-
nals, The Objective Standard.
www.it-ebooks.info
www.it-ebooks.info
Dedication
To my parents, Constance and Stanley Kowalski, who have always encour-
aged me to do the best and at every step helped me to become who I am
today. Thanks, Mom, for making sure I eat right and especially enough.
To my family — Lee Anne, David, Rosemarie, Joseph, Candi, and Reese and
Mason — who helped me to keep focused and moving forward. Thanks for
letting me vent when things weren’t always perfect.
Finally, to the members of the RSA Credentials Everywhere team, past and
present: You have always been behind my efforts to express myself, 100 per-
cent. Thank you for keeping me sane during the non-book-writing hours.
Author’s Acknowledgments
I owe many thanks to Carole Jelen for her efforts to keep me writing. She is
everything I want in an agent, and she has set the bar very high.
Acquisitions Editor Kyle Looper kept me on top of my progress and gave
me more than a few ideas for things to think about and write about. Project
Editor Pat O’Brien has earned tremendous thanks for all his efforts to move
me above the level of apprentice-writer and for keeping me on track with all
my chapters and rewrites. Senior Copy Editor Barry Childs-Helton helped me
greatly by taking my letters and attempts at punctuation and polishing them
into something readable. And Dennis Cohen was phenomenal at keeping my
technical expertise sharpened and shiny.
Thanks to Daniel Bailey at EMC for his efforts to ensure that I maintained a
distinct separation between my EMC efforts and my writing efforts.
And very special thanks to Irina Furman (irina@igrafica.com) for her
work in creating a spectacular set of icons for DiabeticPad.
Lastly, I promised I would thank my supervisor, Jennifer Chong, who gave me
enough time to perform my duties at RSA as well as write another book.
www.it-ebooks.info
Publisher’s Acknowledgments
We’re proud of this book; please send us your comments at http://dummies.custhelp.com.
For other comments, 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.
Some of the people who helped bring this book to market include the following:
Acquisitions, Editorial, and Vertical Websites
Project Editor: Pat O’Brien
Acquisitions Editor: Kyle Looper
Senior Copy Editor: Barry Childs-Helton
Technical Editor: Dennis Cohen
Editorial Manager: Kevin Kirschner
Vertical Websites Project Manager:
Laura Moss-Hollister
Vertical Websites Project Manager:
Jenny Swisher
Supervising Producer: Rich Graves
Vertical Websites Associate Producers:
Josh Frank, Marilyn Hummel, Douglas Kuhn,
and Shawn Patrick
Editorial Assistant: Amanda Graham
Sr. Editorial Assistant: Cherie Case
Cover Photo: © iStockphoto.com / Cary Westfall
Cartoons: Rich Tennant
(www.the5thwave.com)
Composition Services
Project Coordinator: Patrick Redmond
Layout and Graphics: Samantha K. Cherolis
Proofreaders: Melissa Cossell,
Christine Sabooni
Indexer: Potomac Indexing, LLC
Publishing and Editorial for Technology Dummies
Richard Swadley, Vice President and Executive Group Publisher
Andy Cummings, Vice President and Publisher
Mary Bednarek, Executive Acquisitions Director
Mary C. Corder, Editorial Director
Publishing for Consumer Dummies
Kathy Nebenhaus, Vice President and Executive Publisher
Composition Services
Debbie Stailey, Director of Composition Services
www.it-ebooks.info
Contents at a Glance
Introduction 1
Part I: Getting Started on Macintosh Apps 7
Chapter 1: Gathering What You Need to Develop Mac Apps 9
Chapter 2: Mac OS X Coding with Xcode
39
Chapter 3: Giving Your App Something to Do
63
Chapter 4: Objective-C and Cocoa Applications
87
Part II: A View to an App 115
Chapter 5: Using Interface Builder to Lay Out Your Views 117
Chapter 6: Controlling Your Windows and Views
147
Chapter 7: Drawing Advanced Views
177
Part III: Focus on the User 207
Chapter 8: Maintaining Your Users’ Data 209
Chapter 9: Working in the Background
251
Chapter 10: Printing Your User’s Data
283
Part IV: Polishing and Supporting Your App 303
Chapter 11: Debugging Your App 305
Chapter 12: Putting On the Finishing Touches
337
Part V: The Part of Tens 367
Chapter 13: Ten Useful Apple Sample Apps 369
Chapter 14: Ten Macintosh Development Tips 377
Index 387
www.it-ebooks.info
www.it-ebooks.info
[...]... to the Macintosh App Store where users can find it and buy it About This Book Macintosh Application Development For Dummies is a guide to developing Macintosh applications for Apple’s Mac OS X This book will show you the paths through the basics of Mac app development so you can create apps that extend the features and functionality of your Macintosh beyond what Apple provides No Macintosh development. .. consider Objective-C For Dummies by Neal Goldstein Apple also provides many helpful online tutorials for Objective-C and Macintosh development How This Book Is Organized The chapters in Macintosh Application Development For Dummies are divided into five parts Part I: Getting Started on Macintosh Apps Part I opens and walks you through the door into the world of Macintosh application development You’ll... additional information about my Macintosh application, DiabeticPad, at www.diabeticpad.com And you can find sample code for this book at www .dummies. com/go/macintoshappdev Good luck, and happy coding! www.it-ebooks.info 5 6 Mac Application Development For Dummies www.it-ebooks.info Part I Getting Started on Macintosh Apps www.it-ebooks.info Y In this part our objective is to develop an application. .. hand before you start to do Mac development The next sections cover the tools for making Macintosh apps Buying a great development Mac There’s no way around it: You’ll need an Apple Macintosh as your development machine The programming language you use (Objective-C) and the compiler (LLVM) are available to run on many platforms, but only Apple has the libraries and frameworks to run your apps on a Mac. .. familiar with using a Macintosh computer I’ll cover what type of Mac hardware is useful in a later chapter, but for now you don’t need to worry about the differences between an iMac, a MacBook, or a Mac Pro Apple makes OS X behave identically on all Mac models, so your development efforts don’t have to target one machine separate from another You’ll need some skills in using a Macintosh computer You... the ability to craft Macintosh apps beyond the basic software Apple ships with each Macintosh And in January 2011, Apple went one step further: The Macintosh App Store opened its virtual doors, giving Macintosh developers a place to market, advertise, and sell their apps to Macintosh users all around the world Macintosh Application Development For Dummies shows you how to develop a Mac app from concept... Stepping into a Brave, New World of Mac Apps 36 Deciding what kind of app to create 37 Brainstorming, alone or in groups 37 Becoming a Mac developer and App Store seller 38 www.it-ebooks.info x Mac Application Development For Dummies Chapter 2: Mac OS X Coding with Xcode 39 Getting Familiar with Xcode 39 Creating a Macintosh Application with Xcode ... discover what you need to know about Macintosh apps in general and how to get ready for developing Mac apps Before the end of this part, you’ll also create a very basic Macintosh app If you aren’t a registered developer, Bonus Chapter 1 on the web site shows how to get registered and download Xcode, if you don’t have it www.it-ebooks.info 3 4 Mac Application Development For Dummies Part II: A View to an App... creating a Mac app, you’ll have to run it on a Mac anyway to see that it runs the way it should Your development machine will need to handle the following tasks when you’re developing your Mac apps: ✓ Editing code You’ll be typing and editing lots of code, and every Mac available today — from a MacBook to an iMac to a Macintosh Pro — will support this However, larger screens — such as an iMac (Model... you wouldn’t know how Apple stock was doing Does that sound like a dream? Everything I’ve mentioned above is possible for a Mac application A Mac application can hear you speak and analyze your voice — Mac laptops and iMacs come with built-in microphones, and a library of code to listen for and react to sounds Saying specific words in your voice such that an app can identify you as you would be the most . phone.
www.it-ebooks.info
by Karl G. Kowalski
Mac
®
Application
Development
FOR
DUMmIES
‰
www.it-ebooks.info
Mac
®
Application Development For Dummies
®
Published by
John. buy it.
About This Book
Macintosh Application Development For Dummies is a guide to developing
Macintosh applications for Apple’s Mac OS X. This book will
Ngày đăng: 15/03/2014, 20:20
Xem thêm: Mac Application Development For Dummies pdf, Mac Application Development For Dummies pdf