ebook img

Learning iCloud Data Management A Hands-on Guide to Structuring Data for iOS and OS X PDF

433 Pages·2014·11.498 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Learning iCloud Data Management A Hands-on Guide to Structuring Data for iOS and OS X

ptg12441863 Learning iCloud Data Management ptg12441863 Addison-Wesley Learning Series Visit informit.com/learningseries for a complete list of available publications. ptg12441863 The Addison-Wesley Learning Series is a collection of hands-on programming guides that help you quickly learn a new technology or language so you can apply what you’ve learned right away. Each title comes with sample code for the application or applications built in the text. This code is fully annotated and can be reused in your own projects with no strings attached. Many chapters end with a series of exercises to encourage you to reexamine what you have just learned, and to tweak or adjust the code as a way of learning. Titles in this series take a simple approach: they get you going right away and leave you with the ability to walk off and build your own application and apply the language or technology to whatever you are working on. Learning iCloud Data Management A Hands-On Guide to Structuring Data for iOS and OS X ptg12441863 Jesse Feiler Upper Saddle River, NJ (cid:129) Boston (cid:129) Indianapolis (cid:129) San Francisco New York (cid:129) Toronto (cid:129) Montreal (cid:129) London (cid:129) Munich (cid:129) Paris (cid:129) Madrid Capetown (cid:129) Sydney (cid:129) Tokyo (cid:129) Singapore (cid:129) Mexico City Many of the designations used by manufacturers and sellers to distinguish their products Editor-in-Chief are claimed as trademarks. Where those designations appear in this book, and the pub- Mark L. Taub lisher was aware of a trademark claim, the designations have been printed with initial cap- Senior Acquisitions ital letters or in all capitals. Editor The author and publisher have taken care in the preparation of this book, but make no Trina MacDonald expressed or implied warranty of any kind and assume no responsibility for errors or omis- Development sions. No liability is assumed for incidental or consequential damages in connection with Editor or arising out of the use of the information or programs contained herein. Michael Thurston For information about buying this title in bulk quantities, or for special sales opportunities Managing Editor (which may include electronic versions; custom cover designs; and content particular to John Fuller your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at [email protected] or (800) 382-3419. Full-Service Production For government sales inquiries, please contact [email protected]. Manager For questions about sales outside the U.S., please contact [email protected]. Julie B. Nahil Project Editor Visit us on the Web: informit.com/aw Anna Popick ptg12441863 Library of Congress Cataloging-in-Publication Data Copy Editor Feiler, Jesse. Carol Lallier Learning iCloud data management : a hands-on guide to structuring data for iOS and Indexer OS X / Jesse Feiler. Jack Lewis pages cm Includes bibliographical references and index. Proofreader ISBN 978-0-321-88911-9 (paperback : alkaline paper) Anna Popick 1. iCloud—Handbooks, manuals, etc. 2. Cloud computing—Handbooks, manuals, etc. 3. Database management—Handbooks, manuals, etc. 4. iOS (Electronic resource)— Technical Handbooks, manuals, etc. 5. Mac OS—Handbooks, manuals, etc. I. Title. Reviewers QA76.585.F45 2014 Jon Bell 004.67’82—dc23 Erik Buck Rod Strougo 2013043333 Editorial Assistant Copyright © 2014 Pearson Education, Inc. Olivia Basegio All rights reserved. Printed in the United States of America. This publication is protected Cover Designer by copyright, and permission must be obtained from the publisher prior to any prohibited Chuti Prasertsith reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission to Compositor use material from this work, please submit a written request to Pearson Education, Inc., Shepherd, Inc. Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to (201) 236-3290. ISBN-13: 978-0-321-88911-9 ISBN-10: 0-321-88911-8 Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana. First printing, February 2014 Contents at a Glance Preface xvii Acknowledgments xxiii About the Author xxv Introduction 1 I Introducing iCloud 3 1 Exploring iCloud and Its User Experience 5 2 Setting Up iCloud for Development 17 II Using the APIs 33 3 Introducing the APIs and the First Apps 35 ptg12441863 4 Working with the AddressBook API for Contacts 57 5 Managing Calendars and Reminders with the Event Kit API 69 6 Protecting the Privacy of User Data 87 III Using the Technologies 95 7 Introducing Blocks, Threads, and Notifications 97 8 Using Key-Value Coding (KVC) 105 9 Using Preferences, Settings, and Keychains with iCloud 121 10 Managing Persistent Storage with Core Data 133 11 Using Xcode Workspaces for Shared Development 157 12 Adding Data to Apps with Bundles and Resources 169 vi Contents at a Glance IV Using iCloud Documents and Data 185 13 Adding the iCloud Infrastructure 187 14 Working with File Wrappers in iCloud 231 15 Working with iOS Documents 273 16 Working with OS X Documents 317 17 Working with Core Data and iCloud 339 18 Completing the Round Trip 349 Index 379 ptg12441863 Contents Preface xvii Acknowledgments xxiii About the Author xxv Introduction 1 I Introducing iCloud 3 1 Exploring iCloud and Its User Experience 5 Looking at Cloud Computing 5 Understanding the iCloud Paradigm 7 Organizing Files by App 8 Managing Documents with iCloud, Time Machine, and Auto Save 12 Syncing Data Across Devices 13 ptg12441863 Making the Round Trip 14 Chapter Summary 14 Exercises 15 2 Setting Up iCloud for Development 17 Managing App Security on iOS and OS X 18 Identifying Yourself and Your App on developer.apple.com 18 Identifying Your User and Your Ubiquity Container at Runtime 22 Looking Inside the iCloud Basics 23 Apple ID 24 Bundle Identifier 26 Entitlements and Capabilities 28 Ubiquity Container 30 Using iCloud in Your App 30 Chapter Summary 31 Exercises 32 viii Contents II Using the APIs 33 3 Introducing the APIs and the First Apps 35 Getting Started as an Apple Developer 35 Looking at the APIs 37 Introducing the Built-In Data Apps 38 Keeping Up with Apple 38 App Overview 40 Creating Separate Xcode Projects for iOS and OS X 41 Wiring Up the Interfaces 50 Wiring Up the iOS Interface 51 Wiring Up the OS X Interfaces 54 Chapter Summary 55 Exercises 55 4 Working with the AddressBook API for Contacts 57 Considering the AddressBook API on iOS and OS X 57 Sending Mail from the iOS App 58 ptg12441863 Making Sure You Can Send Mail 59 Sending the Message 60 Checking That Mail Is Configured and the Internet Is Available 63 Sending Mail from the OS X App 65 Using Property Lists for Storing and Syncing 65 Chapter Summary 66 Exercises 67 5 Managing Calendars and Reminders with the Event Kit API 69 Exploring the Event Class Hierarchy 70 Setting OS X Permissions 71 Working with the Calendar Database 72 Allocating and Getting Access to the Event Store 72 Creating a New Event or Reminder 75 Searching for an Event or Reminder 76 Setting or Modifying Properties 77 Committing Changes 79 Contents ix Adding a Reminder to the App on iOS 80 Adding an Event to the App on OS X 83 Chapter Summary 85 Exercises 85 6 Protecting the Privacy of User Data 87 The Need for Privacy 87 Looking at Apple’s Rules and Guidelines 88 Best Practices in App Privacy 88 Know What Should Be Private 88 Use Good Programming Style to Enforce Privacy 89 Be Careful When Debugging 89 Ask Permission and Explain What You’ll Do with the Data 90 Do Not Require Personal Data to Unlock Your App 91 Add Extra Measures to Protect Minors 91 Provide Privacy for Support Materials 91 Consider User Issues 92 ptg12441863 Chapter Summary 93 Exercises 93 III Using the Technologies 95 7 Introducing Blocks, Threads, and Notifications 97 Catching Up with Blocks and Threads 98 Queues and Threads 98 Blocks 99 Getting Up to Speed with Notifications 100 Notification Properties 101 Registering for Notifications 101 Posting Notifications 102 Receiving Notification of iCloud Availability Changes 102 Introducing the Second Project 103 Getting Ready to Move On 103 Chapter Summary 104 Exercises 104

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.