iOS 5 Essentials
()
About this ebook
Steven F. Daniel
Steven F. Daniel is originally from London, England, but lives in Australia. He is an experienced software developer with more than 13 years of experience developing desktop and web-based applications for a number of companies, in sectors including insurance, banking and finance, oil and gas, and local government. Xcode 4 iPhone Development Beginner's Guide is his first book. Steven is always interested in emerging technologies, and is a member of the SQL Server Special Interest Group (SQLSIG) and the Java Community. He is the owner and founder of GenieSoft Studios (http://www.geniesoftstudios.com/), a software development company based in Melbourne, Victoria, that currently develops games and business applications for the iOS, Android and Windows platforms. Steven has also been the co-founder and Chief Technology Officer (CTO) of SoftMpire Pty Ltd, a company that focused primarily on developing business applications for the iOS and Android platforms. You can check out his blog at http://geniesoftstudios.com/blog/, or follow him on Twitter at http://twitter.com/GenieSoftStudio.
Read more from Steven F. Daniel
Android Wearable Programming Rating: 0 out of 5 stars0 ratingsApple Watch App Development Rating: 0 out of 5 stars0 ratings
Related to iOS 5 Essentials
Related ebooks
Cocos2D Game Development Essentials Rating: 0 out of 5 stars0 ratingsApplication Development in iOS 7 Rating: 0 out of 5 stars0 ratingsSwift 5 for Absolute Beginners: Learn to Develop Apps for iOS Rating: 0 out of 5 stars0 ratingsIonic Cookbook Rating: 0 out of 5 stars0 ratingsiOS 13 Programming for Beginners - Fourth Edition: Get started with building iOS apps with Swift 5 and Xcode 11, 4th Edition Rating: 0 out of 5 stars0 ratingsObjective-C for Absolute Beginners: iPhone, iPad and Mac Programming Made Easy Rating: 0 out of 5 stars0 ratingsInstant PhoneGap Social App Development Rating: 0 out of 5 stars0 ratingsiOS Application Development with OpenCV 3 Rating: 0 out of 5 stars0 ratingsApplication Development with Swift Rating: 0 out of 5 stars0 ratingsSwift iOS Programming for Kids Rating: 0 out of 5 stars0 ratingsInstant RubyMine Assimilation Rating: 0 out of 5 stars0 ratingsTypeScript Essentials Rating: 4 out of 5 stars4/5Getting Started with React Native Rating: 4 out of 5 stars4/5Objective-C Memory Management Essentials Rating: 0 out of 5 stars0 ratingsMastering The Spritekit Framework: Develop Professional Games With This New Ios 7 Framework Rating: 0 out of 5 stars0 ratingsWindows Phone 7.5 Data Cookbook Rating: 0 out of 5 stars0 ratingsSwift 2 Design Patterns Rating: 0 out of 5 stars0 ratingsNode.js High Performance Rating: 0 out of 5 stars0 ratingsWindows Phone 7.5: Building Location Aware Applications Rating: 0 out of 5 stars0 ratingsRubyMotion iOS Develoment Essentials Rating: 0 out of 5 stars0 ratingsInstant New iPad Features in iOS 6 How-to Rating: 0 out of 5 stars0 ratingsLearning Behavior-driven Development with JavaScript Rating: 5 out of 5 stars5/5PhoneGap and AngularJS for Cross-platform Development Rating: 0 out of 5 stars0 ratingsiOS Developer Solutions Guide: Learn How to Create Stable and Bug-free iOS Apps (English Edition) Rating: 0 out of 5 stars0 ratingsAppium Essentials Rating: 0 out of 5 stars0 ratingsBuilding Android Apps in Python Using Kivy with Android Studio: With Pyjnius, Plyer, and Buildozer Rating: 0 out of 5 stars0 ratingsSwift 2 Blueprints Rating: 0 out of 5 stars0 ratingsJava EE 7 Development with NetBeans 8 Rating: 5 out of 5 stars5/5Learn iOS Application Development: Take Your Mobile App Development Skills to the Next Level with Swift and Xcode (English Edition) Rating: 0 out of 5 stars0 ratingsLearning Yii Testing Rating: 1 out of 5 stars1/5
Information Technology For You
Handbook of Digital Forensics and Investigation Rating: 4 out of 5 stars4/5Summary of Super-Intelligence From Nick Bostrom Rating: 5 out of 5 stars5/5How to Write Effective Emails at Work Rating: 4 out of 5 stars4/5Windows Registry Forensics: Advanced Digital Forensic Analysis of the Windows Registry Rating: 4 out of 5 stars4/5Data Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5How To Use Chatgpt: Using Chatgpt To Make Money Online Has Never Been This Simple Rating: 0 out of 5 stars0 ratingsPractical Ethical Hacking from Scratch Rating: 5 out of 5 stars5/5Cyber Security Consultants Playbook Rating: 0 out of 5 stars0 ratingsChatGPT: The Future of Intelligent Conversation Rating: 4 out of 5 stars4/5CompTIA A+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Core 1 Exam 220-1101 Rating: 0 out of 5 stars0 ratingsComputer Science: A Concise Introduction Rating: 4 out of 5 stars4/5Linux Command Line and Shell Scripting Bible Rating: 3 out of 5 stars3/5Supercommunicator: Explaining the Complicated So Anyone Can Understand Rating: 3 out of 5 stars3/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5Cybersecurity for Beginners : Learn the Fundamentals of Cybersecurity in an Easy, Step-by-Step Guide: 1 Rating: 0 out of 5 stars0 ratingsCompTIA Network+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam N10-008 Rating: 0 out of 5 stars0 ratingsThe Basics of Hacking and Penetration Testing: Ethical Hacking and Penetration Testing Made Easy Rating: 4 out of 5 stars4/5Computer Organization and Design: The Hardware / Software Interface Rating: 4 out of 5 stars4/5AWS Certified Cloud Practitioner: Study Guide with Practice Questions and Labs Rating: 5 out of 5 stars5/5Hacking Essentials - The Beginner's Guide To Ethical Hacking And Penetration Testing Rating: 3 out of 5 stars3/5Inkscape Beginner’s Guide Rating: 5 out of 5 stars5/5Health Informatics: Practical Guide Rating: 0 out of 5 stars0 ratingsGoogle Cloud Platform an Architect's Guide Rating: 5 out of 5 stars5/5COMPUTER SCIENCE FOR ROOKIES Rating: 0 out of 5 stars0 ratingsData Governance For Dummies Rating: 0 out of 5 stars0 ratings
Reviews for iOS 5 Essentials
0 ratings0 reviews
Book preview
iOS 5 Essentials - Steven F. Daniel
Table of Contents
iOS 5 Essentials
Credits
Foreword
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Instant Updates on New Packt Books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Customer support
Downloading the example code
Errata
Piracy
Questions
1. What's New in iOS5
What's new in iOS 5
Reminders
Notification Center
Newsstand
Getting and installing the iOS 5 SDK
Creating the MyMagazineArticle application
Adding the Newsstand Kit framework to our project
Adding properties to our application
Creating the MyEmailApp application
Adding the MessageUI framework to our project
Building TheMyEmailApp user interface
Auto-populating fields
Building and running the MyEmailApp application
iMessage
iPhone Camera
PC Free
Wi-Fi sync
Multitasking gestures
Removing the Xcode developer tools
Summary
2. Using iCloud and the Storage APIs
Comparing Apple iCloud and Google Docs
Storing and using documents in iCloud
Storing key-value data in iCloud
Requesting entitlements for iCloud storage
iCloud backup
Creating the iCloudExample application
Moving a document to iCloud storage
iCloud storage APIs
Searching for documents in iCloud
Working with documents in iCloud
The file coordinator
The file presenter
Handling file-version conflicts
Using iCloud storage responsibly
Summary
3. Debugging with OpenGL ES
Understanding the new workflow feature within Xcode
Creating a simple project to debug an OpenGL ES application
Detecting OpenGL ES state information and objects
View textures
Shaders
Error handling in OpenGL ES
Detecting errors by setting up breakpoints
Setting up breakpoints in your code
Setting conditional OpenGL ES entry point breakpoints
Breaking on frame boundaries
Summary
4. Using Storyboards
Understanding Storyboards
Transitions
How to go about creating Storyboard files
Creating a simple Storyboard (Twitter) application
Creating scenes
Configuring scenes
Building a Twitter application
Composing a Tweet message
Adding photos to a Tweet
Preparing to transition to a new view-controller
Presenting storyboard view-controllers programmatically
Summary
5. Using AirPlay and Core Image
Understanding the AirPlay framework
Creating a simple AirPlay application
Using AirPlay to present application content to Apple TV
Understanding the Core Image framework
Creating a simple Core Image application
Learn how to apply image filter effects using the CIImage class
Color effects
Transitions
Summary
6. Xcode Tools - Improvements
LLVM compiler
Automatic Reference Counting (ARC)
Strong references
Weak references
ARC qualifiers – regular variables
Variable qualifiers
Interface builder
Support for creating storyboard files for iOS applications
Location simulator
Creating a simple geographical application
OpenGL ES debugging
OpenGL ES frame capture
Application data management
UI automation enhancements
Preparing your application
Creating a simple UIAutomation application
Writing the UIAutomation test script
Running your tests
Summary
7. Making your Applications Run Smoothly using Instruments
Introduction to Instruments
Tracing iOS applications
Loading the MapKitExample project
Running and profiling the project
VM faults
Memory leaks
Run-time errors
Compile-time errors
Adding and configuring Instruments
Using the Instruments library
Locating an Instrument within the Library
Adding and removing instruments
Configuring an instrument
Other components of the Instruments family explained
What's new in Instruments
Time Profiler with CPU strategy
System Trace for iOS
Network Connections
Network activity
Summary
Index
iOS 5 Essentials
iOS 5 Essentials
Copyright © 2012 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: January 2012
Production Reference: 1170112
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84719-226-7
www.packtpub.com
Cover Image by Evelyn lam (<yeeyean@gmail.com>)
Credits
Author
Steven F. Daniel
Reviewers
Cory Bohon
John Dometita
Richard England
Chris Gummer
Thanh Huynh
Robb Lewis
Dan Lingman
Acquisition Editor
Wilson D'souza
Lead Technical Editor
Shreerang Deshpande
Technical Editor
Lubna Shaikh
Project Coordinator
Alka Nayak
Proofreader
Lydia May Morris
Indexer
Rekha Nair
Graphics
Manu Joseph
Production Coordinator
Alwin Roy
Cover Work
Alwin Roy
Foreword
Apple's iOS platform, with iPads, iPhones, and iPod touches is the hottest thing in software development right now. An exquisite OS and hardware demands great development tools, and Apple has provided those tools in the form of Xcode. Xcode, just like iOS, is built with ease-of-use in the mind.
Whether you're new to iOS development, or a seasoned pro, this book will guide you through developing in iOS 5 and Xcode 4 with the same ease-of-use that Xcode is known for. It's like this book and iOS 5 development were meant for each other.
Just like Xcode 4, iOS 5 has a lot of new development features, including one of the most-anticipated feature-iCloud. With iCloud, you can store your application's files and settings in the cloud. This book covers these great new features.
With this book, you'll be developing for iOS 5 and using Xcode 4's newest features in no time.
Cory Bohon
About the Author
Steven F. Daniel is originally from London, England, but lives in Australia.
He is the owner and founder of GenieSoft Studios (http://www.geniesoftstudios.com/), a software development company based in Melbourne, Victoria.
Steven is an experienced software developer with more than 13 years of experience in developing desktop and web-based applications for a number of companies, including insurance, banking and finance, oil and gas, and local and state government.
Steven is always interested in emerging technologies, and is a member of the SQL Server Special Interest Group (SQLSIG) and the Java Community. Steven has been the co-founder and Chief Technology Officer (CTO) of SoftMpire Pvt Ltd, a company that focused primarily on developing business applications for iOS and Android platforms.
He is also the author of Xcode 4 iOS Development Beginner's Guide.
You can check out his blog at http://geniesoftstudios.com/blog/, or follow him on Twitter at http://twitter.com/GenieSoftStudio.
Acknowledgements
No book is the product of just the author - he just happens to be the one with his name on the cover.
A number of people contributed to the success of this book, and it would take more space than I have to thank each one individually. A special shout, out goes to Steven Wilding, my acquisition editor, who is the reason that this book exists. Thank you, Steven, for believing in me, and for being a wonderful guide throughout this process. I would like to thank Alka Nayak for ensuring that I stayed on track and got my chapters in on time.
I would also like to thank both my development editors: Shreerang Deshpande and Maitreya Bhakal for their brilliant suggestions on how to improve the chapters, and to Lubna Shaikh for the fantastic job she has done, ensuring that we met the timeframes and delivery for this book.
Lastly, to my reviewers, thank you so much for your valued suggestions and improvements, making this book what it is. I am grateful to each and every one of you.
Thank you also to the entire Packt Publishing team for working so diligently to help bring out a high quality product. Finally, a big thank you to the engineers at Apple for creating the iPhone and the iPad, and for providing developers with the tools to create fun and sophisticated applications. You guys rock.
Finally, I'd like to thank all of my friends for their support, understanding, and encouragement during the writing process. It is a privilege to know each one of you.
About the Reviewers
Cory Bohon is an indie developer, creating iOS and Mac software using many programming languages, including Objective-C, Java, and C/C++. He is also a technology blogger on http://www.maclife.com/, where he writes about Apple news, and Mac and iOS how tos.
Chris Gummer graduated with a Bachelor's of Science majoring in Computing Science and Statistics, in Sydney, Australia. For over a decade, he has developed various software systems across a range of industries. Currently living in London, UK he specializes in iOS application development. He has worked on high profile App Store applications and internal enterprise solutions for iOS devices. At the age of eight, Chris started programming in BASIC, and he still holds the same passion for programming almost thirty years later.
Thanh Huynh started his career as a LAMP developer, with over 10 years experience, and gradually moved into objective-C. Currently working as a freelance iOS developer, he has worked for two of the biggest media companies in the United Kingdom, News International and BSkyB, producing the Times iPad app and Sky Plus.
Robb Lewis is a web developer and student studying web technologies at Portsmouth University. Robb has a great interest in technology, specifically mobile technology, and is an Apple advocate. Robb also writes about software, technology, and the internet at http://therobb.com.
Dan Lingman got his start in programming back in grade 7, when, after seeing a Space Invaders arcade game, he signed up for a night school course in programming the Commodore Pet. This eventually led to a M.Sc. in Computer Science, with his thesis project being a 3D robotics simulator programming in Objective-C on a NeXTStation.
By day, he works for a licensing company, and by night teaches Java development. He also works on iOS development as the technical lead at NoGoToGames.
NoGoToGames is a small company focused on the development of interesting and genre-breaking iOS software. You can see what they are up to at http://www.nogotogames.com/.
I'd like to thank my wife, May, and my daughters, Katrina and Naomi for their patience while I worked on reviewing this book.
www.PacktPub.com
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
Why Subscribe?
Fully searchable across every book published by Packt
Copy and paste, print and bookmark content
On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Instant Updates on New Packt Books
Get notified! Find out when new books are published by following @PacktEnterprise on Twitter, or the Packt Enterprise Facebook page.
This book is dedicated to:
My favorite uncle, Benjamin Jacob Daniel, for always making me smile, and for inspiring me to work hard and achieve my dreams. I miss you a lot.
Chan Ban Guan, for the continued patience, encouragement, support, and most of all, for believing in me during the writing of this book.
Mum and Dad, for always believing in me and for your continued love and support.
My sister Linda, thanks for always being there for me when I needed you most. I love you.
My brother Stuart, thanks for everything Bro.
My niece Ava Madison Daniel, thanks for bringing joy to our family. You’re so cute.
This book would not have been possible without your love and understanding.
Lastly, to my dear friends. Thanks again for your continued love, support and understanding during the writing of this book. It really means a lot to me.
I would like to thank you from the bottom of my heart.
Preface
Building on the phenomenal success of its predecessor, iOS 5 includes over 200 new user features as well as an updated SDK containing over 1,500 new APIs. iOS 5 looks set to reinforce the iPhone's dominance in the smartphone market.
iOS 5 Essentials will help you learn how to build simple, yet powerful iOS 5 applications, incorporating iCloud Storage, Twitter, Core Image and Newsstand integration.
You will start by learning about what's new in iOS 5. You'll look at the iCloud Storage APIs, Automatic Reference Counting, Twitter, and AirPlay integration, how to use the various Core Image filters using the Cocoa framework, and the new features of the iOS 5 SDK. After this, you'll jump straight in and create applications using Xcode and Interface Builder using the new storyboard layout. We then finish up by learning how to make your applications run smoothly using the Xcode instruments.
In this book, I have tried my best to keep the code simple and easy-to-understand. I have provided step-by-step instructions with loads of screenshots at each step to make it easier to follow. You will soon be mastering the different aspects of iOS 5 programming, as well as mastering the technology and skills needed to create some stunning applications. Feel free to contact me at <geniesoftstudios@gmail.com> for any queries, or just want to say 'hello'. Any suggestions for improving this book will be highly regarded.
What this book covers
Chapter 1, What's New in iOS5, introduces the developer to the Xcode developer set of tools, the new features of iOS 5, as well as an introduction into Newsstand and the MessageUI framework.
Chapter 2, Using iCloud and the Storage APIs, introduces you to the benefits of using iCloud, and how to incorporate iCloud functionality into your applications to store and retrieve files, and its data through the use of the storage APIs. This chapter will also give you some insight into how to go about handling file-version conflicts when multiple copies of the same file are being updated on more than one iOS device.
Chapter 3, Debugging with OpenGL ES, focuses on the differences between vertex shaders and fragment shaders, and their relationship with one another. We will become familiar with the OpenGL ES 2.0 Programmable pipeline, and look into the new debugging features of OpenGL ES that enables us to track down issues specific to OpenGL ES, right within the Xcode IDE. We will learn more about the OpenGL