More iPhone Development with Objective-C

Book description

If you are looking to extend your iOS programming skills beyond the basics then More iPhone Development with Objective-C is for you. Authors Dave Mark, Jayant Varma, Jeff LaMarche, Alex Horovitz, and Kevin Kim explain concepts as only they can—with code snippets you can customize and use, as you like, in your own apps.

More iPhone Development with Objective-C is an independent companion to Beginning iPhone Development with Objective-C. That is, it is a perfect second book, but it is also a great book for those looking to improve their skills who have already programmed for iOS. In particular it includes a series of chapters devoted to Core Data, the standard for Apple persistence. The authors carefully step through each Core Data concept and show techniques and tips specifically for writing larger apps—offering a breadth of coverage you won’t find anywhere else.

More iPhone Development with Objective-C covers a variety of other topics, including Multipeer Connectivity’s relatively simple Bluetooth/WiFi peer-to-peer model, MapKit, and media library access and playback so that your applications can utilize media on your users’ computer. You’ll also find coverage of Interface Builder, Live Previews and Custom Controls and some advanced techniques for debugging your applications. The book is filled with useful topics that will bring your programs up-to-date with the new functionality built into iOS.

Table of contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Authors
  8. About the Technical Reviewer
  9. Acknowledgments
  10. Introduction
  11. Chapter 1: Here We Go Round Again
    1. What This Book Is
    2. What You Need to Know
    3. What You Need Before You Can Begin
    4. What’s In this Book
  12. Chapter 2: Core Data: What, Why, and How
    1. A Brief History of Core Data
    2. Creating a Core Data Application
    3. Core Data Concepts and Terminology
    4. The Data Model
      1. Entities
      2. Fetch Requests
      3. Configurations
      4. The Data Model Class: NSManagedObjectModel
      5. The Persistent Store and Persistent Store Coordinator
      6. Reviewing the Data Model
    5. Managed Objects
    6. Key-Value Coding
    7. Managed Object Context
      1. Saves On Terminate
      2. Load Data from the Persistent Store
      3. The Fetched Results Controller
      4. Creating and Inserting a New Managed Object
      5. Deleting Managed Objects
    8. Putting Everything in Context
  13. Chapter 3: A Super Start: Adding, Displaying, and Deleting Data
    1. Setting Up the Xcode Project
      1. Adding a Scene
      2. Scenes and Segues
      3. Storyboard Document Outline
    2. Application Architecture
    3. Designing the View Controller Interface
    4. Creating HeroListController
      1. Making the Connections and Outlets
      2. Navigation Bar Buttons
      3. Tab Bar and User Defaults
    5. Designing the Data Model
      1. Adding an Entity
      2. Editing the New Entity
    6. Declaring the Fetched Results Controller
    7. Implementing the Fetched Results Controller
    8. Fetched Results Controller Delegate Methods
    9. Making It All Work
      1. Error Handling
      2. Implementing Edit and Add
      3. Coding the Table View Data Source and Delegate
      4. Sorting the Table View
      5. Loading the Fetch Request at Launch
    10. Let ’Er Rip
    11. Done, but Not Done
  14. Chapter 4: The Devil in the Detail View
    1. View Implementation Choices
    2. Creating the Detail View Controller
      1. Wiring Up the Segue
      2. HeroDetailController
    3. Detail View Challenges
    4. Controlling the Table Structure with Property Lists
    5. Property Lists Explained
      1. Modeling Table Structure with a Property List
    6. Defining the Table View via Property List
    7. Parsing the Property List
      1. Pushing the Details
    8. Showing the Details
    9. Editing the Details
    10. Editing Mode in the Detail View
    11. Creating a Custom UITableViewCell Subclass
    12. Saving Your Changes
    13. Specialized Input Views
      1. DatePicker SuperDBEditCell Subclass
      2. Using the DatePicker SuperDBEditCell Subclass
      3. Implementing a Selection Picker
    14. Devil’s End
  15. Chapter 5: Preparing for Change: Migrations and Versioning
    1. About Data Models
      1. Data Models Are Compiled
      2. Data Models Can Have Multiple Versions
      3. Creating a New Data Model Version
      4. The Current Data Model Version
      5. Data Model Version Identifiers
    2. Migrations
      1. Lightweight vs. Standard
      2. Standard Migrations
    3. Setting Up Your App to Use Lightweight Migrations
    4. Time to Migrate On
  16. Chapter 6: Custom Managed Objects
    1. Updating the Data Model
      1. Adding the Age Attribute
      2. Adding the Favorite Color Attribute
      3. Adding a Minimum Length to the Name Attribute
    2. Creating the Hero Class
      1. Tweaking the Hero Header
      2. Defaulting
    3. Validation
      1. Single-Attribute Validations
      2. nil vs. NULL
      3. Multiple-Attribute Validations
    4. Virtual Accessors
    5. Adding Validation Feedback
    6. Updating the Detail View
    7. Refactoring SuperDBEditCell
      1. Xcode Refactoring Options
      2. Moving Code Around
      3. Editable Property
    8. Creating a Color Table View Cell
      1. Custom Color Editor
      2. Custom Color Table View Cell
    9. Cleaning Up the Picker
    10. One More Thing
    11. Color Us Gone
  17. Chapter 7: Relationships, Fetched Properties, and Expressions
    1. Expanding Your Application: Superpowers and Reports
    2. Relationships
      1. To-One Relationships
      2. To-Many Relationships
      3. Inverse Relationships
      4. Fetched Properties
      5. Creating Relationships and Fetched Properties in the Data Model Editor
      6. Delete Rules
    3. Expressions and Aggregates
    4. Adding the Power Entity
    5. Creating the Powers Relationship
    6. Creating the Inverse Relationship
    7. Creating the olderHeroes Fetched Property
      1. What Is a Predicate?
    8. Creating the youngerHeroes Fetched Property
    9. Creating the sameSexHeroes Fetched Property
    10. Creating the oppositeSexHeroes Fetched Property
    11. Adding Relationships and Fetched Properties to the Hero Class
    12. Updating the Detail View
      1. Rethinking Configuration
      2. Encapsulation and Information Hiding
      3. Data-Driven Configuration
      4. Adding Powers
    13. Refactoring the Detail View Controller
      1. Renaming the Configuration Class
      2. Refactoring the Detail Controller
      3. Refactoring the Hero Instance Variable
      4. A Little More Abstraction
      5. A New HeroDetailController
    14. The Power View Controller
      1. Navigating to the PowerViewController
    15. Fetch Properties
    16. Wonderful to the Core
  18. Chapter 8: Behind Every iCloud
    1. Data Storage with iCloud
    2. iCloud Basics
    3. iCloud Backup
    4. Enabling iCloud in Your Application
    5. Key-Value Data Storage
    6. Document Storage
      1. UIDocument
      2. UIDocument with iCloud
      3. NSMetadataQuery
    7. Core Data with iCloud
    8. Enhancing SuperDB
      1. Entitlements
      2. Enabling iCloud and Creating the Relevant Files
      3. Updating the Persistent Store
      4. Updating the Managed Object Context
      5. Updating the UI on DataChanged
      6. Testing the Data Store
      7. Keep Your Feet on the Ground
  19. Chapter 9: Peer-to-Peer Over Bluetooth Using Multipeer Connectivity
    1. Peer-to-Peer Connectivity
    2. This Chapter’s Application
    3. Network Communication Models
      1. Client-Server Model
      2. Peer-to-Peer Model
      3. Hybrid Client-Server/Peer-to-Peer
    4. The Multipeer Connectivity Peer
    5. The Multipeer Connectivity Session
      1. Creating the Session
      2. Finding and Connecting to Other Sessions
      3. Listening for Other Sessions
      4. Connecting Peers
      5. Sending Data to a Peer
      6. Packaging Up Information to Send
      7. Receiving Data from a Peer
      8. Closing Connections
      9. Handling a Peer Connection
    6. Creating the Project
      1. Turning Off the Idle Timer
      2. Importing the Multipeer Connectivity Framework
      3. Designing the Interface
      4. Defining Application Constants
      5. Designing the Game Board
      6. Creating the Packet Object
      7. Setting Up the View Controller Header
      8. Implementing the Tic-Tac-Toe View Controller
    7. Trying It
    8. Game On!
  20. Chapter 10: Map Kit
    1. This Chapter’s Application
    2. Overview and Terminology
    3. The Map View
      1. Map Types
      2. Location Authorization
      3. User Location
      4. Coordinate Regions
      5. Setting the Region to Display
      6. The Map View Delegate
    4. Annotations
      1. The Annotation Object
      2. The Annotation View
      3. Adding and Removing Annotations
      4. Selecting Annotations
      5. Providing the Map View with Annotation Views
    5. Geocoding and Reverse Geocoding
    6. Building the MapMe Application
      1. Linking the Map Kit and Core Location Frameworks
      2. Building the Interface
      3. Finishing the View Controller Interface
      4. Writing the Annotation Object Class
      5. Implementing the MapMe ViewController
    7. Go East, Young Programmer
  21. Chapter 11: Messaging: Mail, Social and iMessage
    1. This Chapter’s Application
    2. The MessageUI Framework
      1. Creating the Mail Compose View Controller
      2. Populating the Subject Line
      3. Populating Recipients
      4. Setting the Message Body
      5. Adding Attachments
      6. Presenting the Mail Compose View
      7. The Mail Compose View Controller Delegate Method
      8. Message Compose View Controller
      9. Message Attachments
      10. Disabling Message Attachments
    3. The Social Framework
      1. SLComposeViewController
      2. SLRequest
    4. The Activity View Controller
    5. Building the MessageImage Application
      1. Building the User Interface
      2. Taking the Picture
      3. Calling the Camera
      4. Picking the Message Sender
    6. Mailing It In...
  22. Chapter 12: Media Library Access and Playback
    1. The MediaPlayer Framework
      1. Media Items
      2. Media Item Collections
      3. Media Queries and Media Property Predicates
      4. The Media Picker Controller
      5. The Music Player Controller
    2. Simple Music Player
      1. Building the SimplePlayer Application
      2. Building the User Interface
      3. Declaring Outlets and Actions
    3. MPMoviePlayerController
    4. MPMediaPlayer
    5. AVFoundation
    6. TL;DR: AVKit
    7. Playing Video
    8. AVMediaPlayer
    9. AVMediaPlayer v2
    10. Photo Library
    11. Modifying the Photo Library
    12. Are You Talking To Me?
    13. Avast! Rough Waters Ahead!
  23. Chapter 13: Lights, Camera, and Action
    1. Lights
    2. Camera
    3. Changing Settings
      1. Putting It All Together
    4. Choosing a Camera
    5. Choosing an Output
    6. Scanning Barcodes
    7. Generating Barcodes
    8. Make Some Noise
    9. Recording Audio
    10. The Show Must Go On
  24. Chapter 14: Interface Builder and Storyboards
    1. Storyboard View Controllers
      1. Container View Controller
    2. Segues
    3. Controls
      1. Inspectable
      2. Designable
      3. A More Useful BasicControl
    4. View Controllers
      1. Transitions
    5. Cue ’em Up
  25. Chapter 15: Unit Testing, Debugging, and Instruments
    1. Unit Tests
    2. Debugging
      1. Breakpoints
      2. The Debug Navigator
      3. The Debug Area
      4. Trying Out the Debug Controls
      5. The Breakpoint Navigator and Symbolic Breakpoints
      6. Conditional Breakpoints
      7. Breakpoint Actions
      8. Static Analysis
      9. One More Thing About Debugging
    3. Profiling With Instruments
    4. End of the Road
  26. Chapter 16: The Road Goes Ever On…
    1. Getting Unstuck
    2. Apple’s Documentation
    3. Mailing Lists
    4. Web Sites
    5. Blogs
    6. Combination
    7. Farewell
  27. Index

Product information

  • Title: More iPhone Development with Objective-C
  • Author(s): David Mark, Jayant Varma, Jeff LaMarche, Alex Horovitz, Kevin Kim
  • Release date: May 2015
  • Publisher(s): Apress
  • ISBN: 9781430260387