iOS Cloud Development For Dummies®

Visit www.dummies.com/cheatsheet/iosclouddevelopment 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: Mobile Apps Need to Be Mobile

Part II: Adding iCloud

Part III: Web Services

Part IV: Building Your Own Web Service

Part V: The Part of Tens

Icons Used in This Book

Where to Go from Here

Part I: Mobile Apps Need to Be Mobile

Chapter 1: Compelling Mobile Applications

What Makes Mobile Devices So Compelling

Creating zero degrees of separation

Benefiting from the mobility, not the mobile devices

Increasing the quality of life

Making the technology disappear

Reveling in the aesthetics

An Application Ecosystem

iCloud and universal apps

Web services

The Model View Controller (MVC) Architecture

Evolving the Model View Controller

Chapter 2: The Lonely RoadTrip App

Starting at Square 7

The RoadTrip App

Points of Interest and the Itinerary

How RTModel Manages the Data

Part II: Adding iCloud

Chapter 3: Setting Up Core Data

Managing Your Itinerary

Core Data Basics

Starting with the Objects — The Managed Object Model

Adding the attributes

Generating your classes

Thinking managed objects through

The Core Data Stack

The managed object context

The Persistent Store coordinator and persistent store

Adding the Core Data Stack

Adding the properties needed by the Core Data stack

The managed object context

Concurrency support for managed object contexts

The Persistent Store coordinator

The managed object model

Notifications

ARC and blocks

Adding the Core Data framework

Putting Core Data to Work

Chapter 4: Putting Core Data to Work

Adding a Point of Interest to the Itinerary

Adding a Point of Interest to the Itinerary Using Core Data

The fetch request

Predefining fetch requests in a managed object model

Creating a SharedPointOfInterest

Displaying Your Itinerary

Adding the Fetched Results controller

The Fetched Results controller delegate

Displaying the SharedPointOfInterests

Cleaning Up the ItineraryController and RTModel Classes

Loading the Itinerary

Timing is Everything

Removing a Point Of Interest From the Itinerary

How it works now

Updating for Core Data

Chapter 5: Adding iCloud Support

iCloud

Putting iCloud to work for you

Enter Core Data

Setting up Core Data for iCloud

Handling changes

Configuring Your App’s iCloud Entitlements

Provisioning Your App for iCloud

Testing

Part III: Web Services

Chapter 6: Living in the Cloud

Understanding How Networks Work

The Internet

The World Wide Web

What Exactly Is a Web Service?

Message-oriented web services

Resource-based web services

A Web Service Request

It’s about client-server

And it’s about the URL

URI or URL?

HTTP

The HTTP session

Initial line — Request

Initial line — Response (Status line)

Headers

An optional message body

The RESTful Web Service Architecture

REST requirements

The rationale behind the requirements

It doesn’t matter that most web services aren’t really RESTful

Chapter 7: Exploring an Existing Web Service

The Google Geocoding API

The request

The response

Status codes

How RoadTrip Currently Does Geocoding

Creating the Plumbing: The WSManager

Having the Model Use the Geocoding Web Service

Chapter 8: Working With XML

Parsing the XML Response

Putting the parser through its paces

The NSXMLParser delegate methods

Dealing with errors

Good, But Not Good Enough

Chapter 9: Asynchronous URL Loading

Reviewing Your Choices

URL Loading System Overview

Authentication and credentials

Cookie storage

Protocol support

Using NSURLConnection — Downloading data asynchronously

Using Web Services Asynchronously

Adding the WSLoaderClass

Using the WSLoader

Chapter 10: Adding the JSON Response

Working with JSON

Parsing the JSON Response

Processing a JSON Response

There’s a Pattern to Using Web Services

Add a method to WSManager that makes the request

Add a method to WSManager to set up the request

Add a method to WSManager to create the NSURLRequest

Add a method to YourModel to make the request to the WSManager

Adding a method to YourModel that processes the JSON response

Putting It All Back Together

Part IV: Building Your Own Web Service

Chapter 11: The RoadTrip Web Services

Designing Web Services

The Point of a Web Services Architecture

Design for extensibility (and change)

Optimizing network performance

The Basic Model — Stateless Client Server

Making Services Extensible

Keep things private with encapsulation

Loose coupling

Making services cohesive, complete, and non-overlapping

Well-Formed Services

Services are not functions

Services are not methods

The Resource

The Response

Limiting Unauthorized Web Service Use

Designing a Web Service

The pointsofinterest Web Service

The request

The response

The lastupdate Web Service

The request

The response

The allpointsofinterest Web Service

The request

The response

The addpointofinterest Web Service

The request

The response

The deletepointofinterest Web Service

The request

The response

Additional Error Considerations

Chapter 12: The App Engine Implementation

Google App Engine

The application environment

How App Engine works

App Engine SDKs

Using Python with App Engine

What You Need to Develop for App Engine

The webapp2 Starter Kit

The webapp Framework

Now a little about Python

And more on routing

Handling handlers

A little more Python

The Model Application Controller Architecture in App Engine

Chapter 13: The Model’s Model

What’s in the Model?

The App Engine Datastore

The webapp Model classes

Adding a method to the model

The TestData Class

Testing in Your Browser

Chapter 14: Creating and Using the pointsofinterest Web Service

The pointsofinterest Web Service

Updating RoadTrip

Setting up the WSManager methods to make the request and do the setup

Adding the RTModel methods to make the request and process the JSON response

Adding the required methods to PointOfInterest

Send the new message

Using Cached Data

Adding the UpdateRecord model

Updating RoadTrip to use cached data

Keeping the Points Of Interest Current

Chapter 15: Deploying Your Web Services

Cleaning Up Your App

Transmitting Data Securely Across the Network

Storing Data Securely

Deploying rtpointsofinterest to Google App Engine

What’s Next

Part V: The Part of Tens

Chapter 16: Ten Ways to Extend the RoadTrip App

Dealing with Errors

Make Events a Web Service

Expand the Point of Interest Data

Crowd Source Points of Interest

Cache Data

Post to Facebook and Twitter

Send Postcards from the Road

Add Hotels and Reservations

It’s Never Early Enough to Start Speaking a Foreign Language

In the Road Trip Editor

Chapter 17: 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

iOS Cloud Development For Dummies®

by Neal Goldstein

iOS Cloud Development For Dummies®

Published by
John Wiley & Sons, Inc.
111 River St.
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 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.

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 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 organizatiotn 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 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.

Library of Congress Control Number: 2012944693

ISBN 978-1-118-02623-6 (pbk); ISBN 978-1-118-22226-3 (ebk); ISBN 978-1-118-23582-9 (ebk); ISBN 978-1-118-26073-9 (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 applications. He has had eight applications in the App Store. These include a series of Travel Photo Guides (developed with his partners at mobilefortytwo), and a Digital Field Guides series (http://lp.wileypub.com/DestinationDFGiPhoneApp), developed in partnership with John Wiley & Sons, Inc. 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.

In his copious spare time, he also teaches introductory and advanced classes on iPhone and iPad development (for clients as well as some public classes) and does expert witness work.

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 friends and family — especially to my children, Sarah and Evan, and to my wife, Linda. She deserves special recognition for her support and patience and for maintaining her (and my) sense of humor. Without her support, I never would have been able to write 12 books in 3.5 years. Thank you so much.

This is for you

As day follows night

The tunnel ends in the light

Finally time to play

Author’s Acknowledgments

Acquisitions Editor Katie Feltman has done a superb job of maintaining the vision of this book and keeping this project on track. The editing team on this book was the A+ team and I would give anything to work with them on every book I do. Project editor Paul Levesque is the project editor’s project editor, and the best in the known and unknown universe. If there were one, he would deserve an entry in the Hitchhiker’s Guide to the Galaxy. Copy editor Virginia Sanders did an amazing job, helping to both clarify things and pointing out inconsistencies in places I had long forgotten about. Tech editor Jesse Feiler kept me on my toes and his comments made this a better book. Great job, team, and I deeply appreciate all of your work.

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

Senior Project Editor: Paul Levesque

Acquisitions Editor: Katie Feltman

Copy Editor: Virginia Sanders

Technical Editor: Jesse Feiler

Editorial Manager: Leah Michael

Editorial Assistant: Leslie Saxman

Sr. Editorial Assistant: Cherie Case

Cover Photo: ©iStockphoto.com / Marcin Krygier; ©iStockphoto.com / ranplett

Cartoons: Rich Tennant (www.the5thwave.com)

Composition Services

Project Coordinator: Sheree Montgomery

Layout and Graphics: Lavonne Roberts

Proofreaders: Lindsay Amones, John Greenough

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

Kathleen Nebenhaus, Vice President and Executive Publisher

Composition Services

Debbie Stailey, Director of Composition Services

Introduction

When you talk about iOS cloud programming, you’re talking about two distinct things. The one is iCloud, which is implemented for you by Apple and allows you to synch data between devices. The other is web services, which enable you to have some of your app’s processing done by a remote computer somewhere in the middle of who-knows-where. iCloud is relatively new; web services have been around for a long time.

In fact, web services and I go way back.

Although I had used them for quite a while, the value of web services was driven home when I was consulting for a large mainframe-based organization. (Yes, that was a long time ago.) The organization had acquired a company and needed to interface the two computer systems. The systems were very different, and time-to-market and (especially) cost considerations made wholesale rewriting of the acquired company’s systems impractical, not to mention foolish.

So, instead I took the functionality of the acquiring company’s computer systems and made that functionality accessible (wrapping them as the terminology goes) as web services. Then all I had to do was go in and make some small changes to the acquired company’s system to call those web services and, voilà, I was done.

Okay, the solution required a bit more work than that, but a lot less than rewriting all those COBOL programs. (I told you this was a long time ago.)

Worked great.

Later on, I did the same thing for a company whose architecture had stood them well for years but was becoming brittle with the new demands of customer access on the web — it was getting harder and harder to add the functionality needed in an Internet-based, real-time world. In addition, the company’s current architecture was synchronous, so the slightest hiccup could cause the whole system to grind to a halt.

In that situation, I wrapped existing functionality in an asynchronous service-oriented architecture that made it easy to add new functionality as well as replace the old technology as necessary without breaking anything.

Worked great there, too.

Given this successful background in service-oriented architecture — an architecture that serves as the foundation for all web services — you can imagine that I jumped at the chance when the folks at Wiley asked me to write a book on cloud computing.

Even though all this talk about wrapping and service-oriented architecture may not sound like the web services you’ve heard about, it actually is the same thing. Web services, like objects, allow you to hide the implementation behind a defined interface, allowing you to evolve the implementation without breaking the clients. And, as described in Chapter 6, this is one of the things that make web services so powerful.

Hiding the implementation is exactly what you’ll be doing in this book — having a server in the cloud do some processing for you. Although this time, instead of wrapping existing functionality, you’ll write the service as well (with lots of help from me).

I’ll let you in on a little secret. I also jumped at the chance to write this book because it is my firm belief that web services (and here I include iCloud) provide a game changer within a game changer. When the iPhone SDK was first released, I saw a game changer that could rank right up there with the introduction of the Macintosh personal computer. When web services get added to the mix, they elevate a mobile device to a full-fledged computing device as well as extend the value that technology can provide to the everyday user.

What makes this even easier is iOS 5 and, more importantly, Xcode 4.3, where the nuts and bolts of application development — especially the ability to take advantage of web services — have changed dramatically. Even though Xcode 4.3 has added much more functionality to the Integrated Development Environment (IDE) with which you develop iOS applications, especially when it comes to writing syntactically correct (and bug-free) code that’s better able to manage memory, it’s the whole storyboard concept that is the real headline.

Storyboards, one of my all-time favorite new features, allow you to develop applications in a new way, with much less code and a better idea of what the flow of the application (and subsequent user experience) will be.

But what’s more, storyboards all of a sudden make it easier to develop universal applications — applications that run with equal aplomb on the iPad or iPhone — using the same code base! And when you do that, using iCloud and web services becomes a whole lot easier.

This is great stuff!

About This Book

iOS Cloud Development For Dummies is a guide to using iCloud, using web services on iOS devices, and developing your own web services. This book distills the hundreds (or even thousands) of pages of documentation (not to mention my own development experience) into only what’s necessary to start you developing and using web services. But this is no recipe book that leaves it up to you to put it all together; rather, it starts with an existing universal application and shows you how to extend its functionality. You’ll be able to share data between an iPad and iPhone running the app, and you’ll be able to keep the application data current by using web services.

I assume that you’re in this for the long haul and you want to master the use of web services. I use a real-world application to show the concepts and give you the background on how things actually work. So be prepared! There may be some places where you might want to say, “Get on with it,” but — based on my experience, including eight apps in the App Store, 12 books (and counting), and untold hours spent on in-person classes and technical talks — I’m giving you what you need to move from following recipes in a cookbook by rote to modifying and even creating your own recipes.

Conventions Used in This Book

Code examples in this book appear in a monospaced font so that they stand out. That means the code you see will look like this:

#import <UIKit/ UIKit.h>

Objective-C is based on C, which (I want to remind you) is case-sensitive, so please enter the code that appears in this book exactly as it appears in the text. I also use the standard Objective-C naming conventions — for example, class names always start with a capital letter, and the names of methods and instance variables always start with a lowercase letter.

The width of a page may force me to show you a single line of code on two lines. This can be a problem with string literals — text with quotes around it — so when you see a string on two lines, you’ll need to keep it on a single line in your code.

All those details are also true for the Python programming language (which I explain to you as you need it). In addition, Python is based on indentation, so I make sure to point out where you need to be careful.

Let me also mention that all URLs in this book look like this:

www.nealgoldstein.com

Sometimes I ask you to delete some of the code you have in place for your project in order to make room for new stuff. When that happens, I refer to code I want you to delete as bolded-underlined-italicized code, because said code will show up as bold, underlined, and italic. Simple enough. For example,

Delete this

If you’re ever uncertain about anything in the code, you can always look at the source code on my website at www.nealgoldstein.com. From time to time, I provide updates for the code there and post other things you may find useful. (You can grab the same material from the For Dummies website at www.dummies.com/go/iosclouddev.)

To make things easier for you, I also have you download two Xcode projects — RoadTrip and Road Trip Editor. You can find these two projects at my website at www.nealgoldstein.com and of course from the handy For Dummies website at www.dummies.com/go/iosclouddev.

Foolish Assumptions

To begin developing apps that use web services — as well as the services themselves — you’re going to need an Intel-based Macintosh computer with the latest possible version of the OS X on it. You also need to download the iOS Software Development Kit (SDK), which is free. And, oh yeah, you need an iPad or an iPhone. You’ll also use the Simulator that Apple provides with the iPad SDK during the initial stages of development, but at some point, you’ll want to test your application on a real, live device. Note as well that, when you’re working with iCloud, you’ll need access to two devices if you want to be able to test your work.

This book is not an introductory book. It assumes that you have some knowledge of iOS development, object-oriented programming, and Objective-C. On the other hand, it assumes you know nothing about networking, the cloud, or web services.

How This Book Is Organized

iOS Cloud Development For Dummies has five main parts.

Part I: Mobile Apps Need to Be Mobile

In Part I, I explain why users find their mobile devices so compelling and also explore how applications can take advantage of the similar and unique characteristics of the iPhone and the iPad. I explain the Application Ecosystem, where users can choose the right device for the right job with their application data shared between the devices.

I also show you how web services can help you create more compelling applications that increase the mobility of the user while still keeping them firmly plugged in to their person ecosystems.

You also embark on a brief tour of the RoadTrip app — a universal app that runs on both the iPhone and iPad. This is the app you’ll be extending and enhancing to make it far more appealing to a user by evolving it to a true Application Ecosystem app by adding iCloud support and web services.

Part II: Adding iCloud

In this part of the book, you discover how you can use iCloud to synchronize data between two devices running the same application. I explain Core Data, which is a way to store persistent objects, and I show you how to use Core Data to manage the points of interest you have in your itinerary — all parts of the RoadTrip app that you’ll get to know in detail.

I start with the Core Data stack and then show you how to use Core Data within an application. Then I show you how to use Core Data to add iCloud support, enabling you to manage that trick of sharing data between multiple devices running RoadTrip.

Part III: Web Services

Part III starts you on the process of having your application actually use web services. I start by explaining about networks, the Internet, and the World Wide Web and the technology behind web services.

You then begin your real work by stepping through what actually happens when you make use of a web service — in this case, the Google Geocoder web service. I take you through how to use the URL loading system to make asynchronous web service requests, and I show you how to parse both XML and JSON response to use the web service data in your application.

In the process, you’ll create two classes that you will continue to use in the book and can easily use in your own applications.

The first is the WSManager — it handles the actual construction of your web service request. The second is the WSLoader, which uses the URL loading system to asynchronously make the request and download the response from a web service.

Part IV: Building Your Own Web Service

Part IV is where you actually get to build your own web services.

You use Google App Engine to host your web service as well as GoogleAppEngineLauncher to develop your web services on your local machine.

I take you through the criteria for good web services and the specification of the web services that you’ll use in RoadTrip and in the Road Trip Editor, which will enable you to add and delete points of interest from your web services database. (The actual Adding and Deleting business gets covered in an extra special Bonus Chapter, available for download from this book’s website.)

I explain how Google App Engine works and give you a tutorial (in context) on how to code your web services in Python.

I close by talking a bit about security, and then you finally get to upload your app to App Engine, and off you go.

Part V: The Part of Tens

Part V consists of some tips to help you avoid having to discover everything the hard way. This part talks about approaching application development in an adult way right from the beginning (without taking the fun out of it, I assure you). I also revisit the RoadTrip app and explain what else you would need to do to make this app a commercial and critical success.

Icons Used in This Book

This icon indicates a useful pointer that you shouldn’t skip.

This icon represents a friendly reminder. It describes a vital point that you should keep in mind while proceeding through a particular section of the chapter.

This icon signifies that the accompanying explanation may be informative (dare I say “interesting”?), but it isn’t essential to understanding iPad application development. Feel free to skip past these tidbits if you like (though skipping while learning may be tricky).

This icon alerts you to potential problems that you may encounter along the way. Read and obey these blurbs to avoid trouble.

Where to Go from Here

It’s time to explore the cloud!

Also, be sure to visit my website, www.nealgoldstein.com, and the companion website for this book, www.dummies.com/go/iosclouddev, for source code, a handy Bonus Chapter, and other information. For updates to this edition, check out www.dummies.com/go/iosclouddevupdates. Now, go out there and have some fun!

Please note that some special symbols used in this eBook may not display properly on all eReader devices. If you have trouble determining any symbol, please call Wiley Product Technical Support at 800-762-2974. Outside of the United States, please call 317-572-3993. You can also contact Wiley Product Technical Support at www.wiley.com/techsupport.

Part I

Mobile Apps Need to Be Mobile

In this part . . .

You’ve decided that it’s time to be in the cloud. In this part, I explain why that’s a smart decision and then go on to tell you how you can really take advantage of cloud computing. I also go ahead and explain RoadTrip, the sample app you’ll work with throughout this book. RoadTrip is an almost commercially viable app (but please don’t go selling it in the store) that just needs a few more features to make it take off. After I explain RoadTrip’s nuts and bolts, you’ll be set to take the next step and elevate it to the cloud.

Chapter 1

Compelling Mobile Applications

In This Chapter

arrow Discovering what makes mobile devices so appealing

arrow Acknowledging the strengths and weaknesses of mobile devices

arrow Working with Application Ecosystems

arrow Tweaking your Model Application Controller

Let me be honest with you. The dirty little secret is that cloud computing is nothing new. It’s really just a variation (yet another one) on client-server computing.

The client-server model of computing distributes the tasks of an application between the providers of a resource or service (called servers) and service requesters (called clients). It’s been around for quite a while — since the 1980s, in fact, when it was used in the context of personal computers on a network (usually a LAN). It has evolved over time and is also one of the central ideas of network computing. As I explain in Chapter 2, the Internet’s main application protocols, HTTP, SMTP, Telnet, and DNS use client-server computing, and web browsers and web servers have a client server relationship.

I talk a lot about client-server in this book, but in this chapter I concentrate on your application design. And, although this book focuses on the client-server design and implementation in an application, I spend at least a little time talking about your application functionality as well. I’d hate to have you spend all that time implementing iCloud and web services in an application that no one finds particularly useful.

So start at the beginning with a simple question: What is it about the iPhone and the iPad that makes them so appealing?

What Makes Mobile Devices So Compelling

Although I had been somewhat involved with the mobile platform for a number of years, it became my number one passion when the iPhone SDK was released in March of 2008.

It became obvious at that point that the SDK was a real game changer, up there with the release of the Macintosh.

I realized that the iPhone wasn’t simply a smaller personal computer. It was, in fact, an entirely new way of using technology, one that could create an entirely new user experience

“Why?” you ask? Let me count the ways.

First of all, because your iPhone is always on, it gives you immediate access to everything that’s important to you — your personal contacts, calendar, music, videos, and even games. And if what you want isn’t right there on the iPhone, you can immediately access it through the Internet using its “always there” connection. It also gives you immediate access to everyone that’s important to you through the phone itself, text messaging, and (recently) notifications and Voice over IP.

But to be honest, that access is already possible on your personal computer. The new wrinkle comes from the fact that the phone can come with you — you don’t have to go to it. Moreover, you’re always connected through the cellular network, rather than tethered to an Ethernet cable or relying on the limited reach of Wi-Fi. What’s more, not only does it come with you, but letting you know where you are. It even knows its orientation, heading, and movement as you take it from place to place.

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!