iPhone Application Development For Dummies - Neal Goldstein - E-Book

iPhone Application Development For Dummies E-Book

Neal Goldstein

4,8
20,99 €

oder
-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

Start building iPhone apps today with this friendly guide, nowin full color! Whether you're a beginning programmer who wants to build yourfirst app or a professional developer looking to leverage themarketing power of the iPhone SDK, this book will help. It walksyou through the basics for building a variety of iOS applicationsusing Apple developer tools and covers the essential steps forcreating apps that get accepted into the App Store. This newedition covers all the latest information, including key updates toiPad universal code and tips on developing specifically for mobileapps. Full-color illustrations make it easier to see exactly whatwill appear on your screen. * Walks you through the fundamentals of developing a variety ofapplications for the iPhone * Shows you how to use Apple's developer tools * Delves into getting your apps into the App Store and sellingthem * Addresses the universal code feature that allows you to developapps and port them from the iPhone to the iPad and back * Covers the latest updates for the iPad universal code and thenew iPhone SDK No matter what your level of expertise may be, you'll be able toleverage the power of the iOS SDK with the advice in thisfull-color book. Note: Apple's iOS SDK tools are onlyaccessible on Intel-powered Mac and MacBookdevices.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 526

Veröffentlichungsjahr: 2012

Bewertungen
4,8 (18 Bewertungen)
14
4
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



iPhone Application Development For Dummies®, 4th Edition

Visit www.dummies.com/cheatsheet/iphoneapplicationdevelopment to view this book's cheat sheet.

Table of Contents

Introduction
About This Book
Conventions Used in This Book
Foolish Assumptions
How This Book Is Organized
Part I: Getting Started
Part II: Working with the Storyboard and User Interface
Part III: Understanding the Wiring and Plumbing
Part IV: Finishing the Basic Application Structure
Part V: Adding the Application Content
Part VI: The Part of Tens
Icons Used in This Book
Where to Go from Here
Part I: Getting Started
Chapter 1: Creating Compelling Mobile Applications
Welcome to Mobile 2.0
What Makes Mobile Devices So Compelling?
Zero degrees of separation
Enhancing mobility
Increasing the quality of life
The Device Itself Engages the User
The sense of freedom that comes with mobility
The technology disappears
The aesthetics
It’s extensible
Exploiting the Device Features to Create a Great Application
Personal stuff
Accessing the Internet
Maps and location and orientation and movement
Communication
Device-Driven Design
iPhone strengths and weaknesses
iPad strengths and weaknesses
Creating Your Own Applications
iPhone applications
iPad applications
An Application Ecosystem
Enter the Cloud
Developing an App the Right Way Using the Example App in this Book
Chapter 2: Getting to Know the SDK
Developing Using the SDK
Using XCode to Develop an App
Creating an Xcode project
Developing the application
The Workspace Window
Workspace areas
Displaying an area’s content
The toolbar and Tab bar
The Organizer window
Chapter 3: The Nuts and Bolts of an Xcode Project
Creating Your Project
Exploring Your Project
The Project
The Project Editor
The Project navigator
Preferences Galore! Setting Your Xcode Preferences
Building and Running Your Application
Building an app
The Log navigator
Running in the Simulator
Interacting with simulated hardware
Making gestures
Uninstalling apps and resetting your device
Living with Simulator’s limitations
Adding an Application Icon
Standard and retina display images
Adding the icon
Run your project
Part II: Working with the Storyboard and User Interface
Chapter 4: Storyboards and the User Experience
Introducing the Storyboard
Defining What You Want an Application to Do: The RoadTrip Application
Creating the Application Architecture
Using Frameworks
Using Design Patterns
The iOS design patterns
The Model-View-Controller (MVC) design pattern
Working with Windows and Views
Looking out the window
Admiring the view
The kinds of views you use
View Controllers — the Main Storyboard Player
What About the Model?
It’s Not That Neat
Taking a Look at Other Frameworks
The Foundation framework
The Core Graphics framework
Even more frameworks
Understanding How the MVC Model Is Expressed in the Project
Chapter 5: Creating the RoadTrip User Interface Using the Storyboard
Creating Your User Interface in the Storyboard
It’s about the view controller
Using Interface Builder to add the user elements
Working within the Utility Area
Inspector and Quick Help pane
Library pane
Understanding the Navigation Controller
Adding the Navigation Controller
Adding an identifier to the view controller
Adding the User Interface Objects
Part III: Understanding the Wiring and Plumbing
Chapter 6: Adding Outlets and Actions to Your RoadTrip Code
Understanding Outlets
Adding Outlets
Opening the Assistant editor
Creating the outlet
The Connections inspector
Working with the Target-Action Design Pattern
Using the Target-Action pattern: It’s about controls
Adding an action
How Outlets and Actions Work
Chapter 7: Understanding the Runtime, Managing Memory, and Using Properties
Stepping Through the App Life Cycle
UIApplicationMain
Handling events while your application is executing
Knowing what to do when the normal processing of your application is interrupted
An Overview of the View Controller Life Cycle
Working within the Managed Memory Model Design Pattern
Understanding memory management
Using reference counting
Automatic Reference Counting
Rule 1: Do not call the retain, release, or autorelease methods
Rule 2: Do not store object pointers in C structures
Rule 3: Inform the compiler about ownership when using Core Foundation-style objects
Rule 4: Use the @autoreleasepool keyword to mark the start of an autorelease block
Rule 5: Follow the naming conventions
Working with variable types according to ARC
Understanding the deadly retain cycle
Observing Low-Memory Warnings
The viewDidUnloadmethod
The didReceiveMemoryWarning method
applicationDidReceiveMemoryWarning:
UIApplicationDidReceiveMemoryWarning Notification: notification
Picking the right memory-management strategy for your application
Customizing the Behavior of Framework Classes
Subclassing
The Delegation pattern
Understanding Declared Properties
What comprises a declared property
Using dot syntax
Setting attributes for a declared property
Writing your own accessors
Accessing instance variables with accessors
Hiding Instance Variables
Part IV: Finishing the Basic Application Structure
Chapter 8: Working with the Source Editor
Navigating in the Xcode Source Editors
Using the Jump bar
Organizing your code using the #pragma mark statement
Using the Xcode Source Editor
Using Live Issues and Fix-it
Compiler warnings
The Issue navigator
Accessing Documentation
Getting Xcode help
The Organizer window
The Help menu
Finding and Searching in Your Project
Using the Find command to locate an item in a file
Using the Search navigator to search your project or framework
Using the Symbol Navigator
You’re Finally Ready to Code!
Chapter 9: It’s (Finally) Time to Code
Checking for Network Availability
Downloading the Reachability sample
Adding the code to check for reachability
Sprucing Up the Main View
Understanding Autorotation
Writing Bug-Free Code
Working in the Debug Area and Debug Navigator
Managing breakpoints
What you find in the Debug area
What you find in the Debug navigator
Displaying variables in the Source editor
Tiptoeing through your program
Chapter 10: Adding Animation and Sound to Your App
Understanding Animation on the iPhone
View geometry and coordinate systems
Points versus pixels
A view’s size and position
Animating a View
Finally, More Code
Implementing the testDrive Method
Understanding Blocks
Rotating the Object
Working with Audio on the iPhone
Tracking Touches
Animating a Series of Images “In Place”
Chapter 11: Finishing the Basic Application Structure
Extending the Storyboard to Add More Functionality to Your App
Adding the Remaining Elements You Need in Your Storyboard
Add a Gesture Recognizer
Chapter 12: The Trip Model
What’s in the Model
Adding the Model Data
Using property lists
Adding a property list to your project
Adding the First Model Class
Understanding the Trip Interface
Implementing the Trip Class
Initializing objects
Invoking the superclass’s init method
Initializing instance variables
Returning self
Initializing the Destination Class
Creating the Trip object
More Debugger Stuff
Chapter 13: Implementing the Content Controller
Using Custom View Controllers
Adding the custom view controller
Setting up the ContentController in the MainStoryboard
Add a Background Image and Title
Part V: Adding the Application Content
Chapter 14: How’s the Weather? Working with Web Views
Setting Up the Weather Controller
Adding the custom view controller
Setting up the WeatherController in the MainStoryboard File
The Weather Controller
Managing links in a Web view
More Opportunities to Use the Debugger
Unrecognized selector sent to instance . . .
NSUnknownKeyException
Chapter 15: Displaying Events Using a Page View Controller
Setting Up the Events Controller
Adding the custom view controller
Setting up the EventsController in the MainStoryboard
Adding and Setting up the EventPageController in the MainStoryboard
Extending the Trip Model
Adding the Events Class
The EventsController and Its PageViewController
Data sources and delegates
Data source
Delegate
The EventsController
The EventPageController
Chapter 16: Finding Your Way
Setting Up the Map Controller
Adding the custom view controller
Setting up the MapController in the MainStoryboard
Putting MapKit through Its Paces
MKMapView
Enhancing the map
Changing the Map Type
Adding Annotations
Creating the annotation
Displaying the annotations
Going to the Current Location
Chapter 17: Geocoding
Understanding Geocoding on the iPhone
Reverse Geocoding
Chapter 18: Selecting a Destination
Adding the DestinationController
Adding the custom view controller
Adding and setting up the DestinationController in the MainStoryboard
Adding a Modal View
Table views
Creating the Table View
Adding sections
Displaying the cell
Working with user selections
Handling the Destination the First Time RoadTrip is Launched
A Word about Adding Settings
What’s Next?
Part VI: The Part of Tens
Chapter 19: Ten Ways to Extend the RoadTrip App
Add Preferences
Cache Data
Monitor the Current Location’s Distance from the Destination
Post to Facebook and Twitter
Send Postcards from the Road
Add Hotels and Reservations
Create an Itinerary
Make the App Part of an Application Ecosystem
It’s Never Early Enough to Start Speaking a Foreign Language
Some Implementation Enhancements
Chapter 20: Ten Ways to Be a Happy Developer
Keep Things Loosely Coupled
Remember Memory
Don’t Reinvent the Wheel
Understand State Transitions
Do the Right Thing at the Right Time
Avoid Mistakes in Error Handling
Use Storyboards
Remember the User
Keep in Mind that the Software Isn’t Finished Until the Last User Is Dead
Keep It Fun
Cheat Sheet

iPhone® Application Development For Dummies®, 4th Edition

by Neal Goldstein

iPhone® Application Development For Dummies®, 4th Edition

Published byJohn Wiley & Sons, Inc.111 River St.Hoboken, NJ 07030-5774

www.wiley.com

Copyright © 2012 by John Wiley & Sons, Inc.

Published by John Wiley & Sons, Inc., Hoboken, NJ

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 permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. 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 John Wiley & Sons, Inc. 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 affiliates in the United States and other countries, and may not be used without written permission. 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 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, 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 at www.wiley.com.

Library of Congress Control Number: 2011946310

ISBN 978-1-118-09134-0 (pbk); ISBN 978-1-118-22333-8 (ebk); ISBN 978-1-118-23680-2 (ebk); ISBN 978-1-118-26173-6 (ebk)

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

About the Author

Neal Goldstein is a recognized leader in making state-of-the-art and cutting-edge technologies practical for commercial and enterprise development. He was one of the first technologists to work with commercial developers at firms such as Apple Computer, Lucasfilm, and Microsoft to develop commercial applications using object-based programming technologies. He was a pioneer in moving that approach into the corporate world for developers at Liberty Mutual Insurance, USWest (now Verizon), National Car Rental, EDS, and Continental Airlines, showing them how object-oriented programming could solve enterprise-wide problems. His book (with Jeff Alger) on object-oriented development, Developing Object-Oriented Software for the Macintosh (Addison Wesley, 1992), introduced the idea of scenarios and patterns to developers. He was an early advocate of the Microsoft .NET framework, and he successfully introduced it into many enterprises, including Charles Schwab. He was one of the earliest developers of Service Oriented Architecture (SOA), and as Senior Vice President of Advanced Technology and the Chief Architect at Charles Schwab, he built an integrated SOA solution that spanned the enterprise, from desktop PCs to servers to complex network mainframes. (He holds four patents as a result.) As one of IBM’s largest customers, he introduced the folks at IBM to SOA at the enterprise level and encouraged them to head in that direction.

Since the release of the iPhone SDK in March 2008, he has been focusing on mobile application. He has eight applications in the App Store. These include a series of Travel Photo Guides (http://travelphotoguides.com), developed with his partners at mobilefortytwo, and a Digital Field Guides series (http://lp.wileypub.com/DestinationDFGiPhoneApp), developed in partnership with John Wiley & Sons. He also has a free app called Expense Diary that allows you to keep track of things like expenses, mileage, and time by adding them to your calendar.

He has developed mobile strategies for a number of businesses ranging from National Cinemedia to the American Automobile Association (AAA). His strategies focus on Mobile 2.0 — integrating mobile across the enterprise, creating a consistent user experience across devices and applications in an application ecosystem, and developing a user experience architecture that both leverages, and is constrained by, the device. He has spent the last three years working with mobile device users and developers to determine what makes mobile devices so appealing, what users want from an application on a phone or tablet, and what makes an app compelling. These efforts have resulted in the Application Ecosystem model for mobile applications and an underlying Model Application Controller Architecture based on web services that has become a key element in his client work and his books.

Along with those apps and his consulting, he has written several books on iPhone programming, iPhone Application Development For Dummies (multiple editions) (Wiley), Objective-C For Dummies (Wiley), and he co-authored (with Tony Bove) iPad Application Development For Dummies (including multiple editions) (Wiley) and iPhone Application Development All-in-One For Dummies (Wiley). He’s also the primary author (with Jon Manning and Paris Buttfield-Addison) of iPhone & iPad Game Development For Dummies.

Dedication

To my wife, Linda. Without her, I never would have been able to write 11 books in the last three years. She deserves special recognition for her support and patience and for maintaining her (and my) sense of humor. I’ve got to be the luckiest guy in the world. Thank you.

Author’s Acknowledgments

Thanks to my friend Jeff Elias for the San Francisco and Yosemite photographs used in the RoadTrip application.

There is no better Acquisitions Editor than Katie Feltman, who does a superb job of keeping me on track and doing whatever she needs to do to allow me to stay focused on the writing. Thanks also to Project Editor Susan Christophersen and Tech Editor Dave Diamond.

Thanks again to my agent Carole Jelen for her continued work and support in putting and keeping these projects together.

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: Susan Christophersen

Acquisitions Editor: Katie Feltman

Technical Editor: Dave Diamond

Editorial Manager: Jodi Jensen

Vertical Websites: Rich Graves

Editorial Assistant: Amanda Graham

Sr. Editorial Assistant: Cherie Case

Cover Photos: © iStockphoto.com / Alwyn Cooper

Cartoons: Rich Tennant (www.the5thwave.com)

Composition Services

Project Coordinator: Sheree Montgomery

Layout and Graphics: Joyce Haughey, Sennett V. Johnson

Proofreaders: Susan Hobbs, Lauren Mandelbaum

Indexer: BIM Indexing & Proofreading Services

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

Part I

Getting Started

So you’ve decided you want to develop some software for the iPhone. You have a good idea for a utility — one that lets you know where and when the next piece of space junk will crash into earth, or one that acts as a data-driven application (say, one that knows where to find the best pizza in Silicon Valley). Now what?

This part of the book lays out what you need to know to get started on the development journey. First, what makes a great iPhone application? Knowing that, you can evaluate your idea, see how it ranks, and maybe figure out what you have to do to transform it into something that knocks your users’ socks off.

This part shows you how to use the iPhone Software Development Kit (SDK), which includes Xcode — your home away from home when you are developing your app. You also find out how to create an Xcode project, within which you code and then build and run your app.

Chapter 1

Creating Compelling Mobile Applications

In This Chapter

Knowing what makes mobile devices so appealing

Understanding the strengths and weaknesses of mobile devices

Assessing the right application for the right device — the “Application Ecosystem”

The last time I looked, it seemed as though every developer with an iPhone and a Macintosh had developed an application and put it in the store.

Okay, I exaggerate a bit, but not by much.

But creating a successful mobile app today is a lot different from how it was when Apple first opened the iPhone to third-party developers in March 2008. And being late to this party (as opposed to being an underdressed Californian racing to catch the last flight out of New York on a bitterly cold night) may actually be a good thing. A fairly clear picture is emerging of where things are heading based on what users want and need, and having that picture is a great position to be in when you’re developing applications.

In this chapter, I explain what you need to understand about iPhone applications (and mobile applications in general) and what you need to think about before you go out and develop a new app.

Welcome to Mobile 2.0

Like the World Wide Web, mobile applications are evolving at breakneck speeds. Users are demanding, and developers are creating, new kinds of applications all the time. These Mobile 2.0 applications are optimized for the mobile experience and integrated with web and desktop applications to create a seamless and consistent user experience across devices.

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!