Home > Store

Mastering iOS Frameworks: Beyond the Basics, 2nd Edition

Register your product to gain access to bonus material or receive a coupon.

Mastering iOS Frameworks: Beyond the Basics, 2nd Edition

Book

  • Sorry, this book is no longer in print.
Not for Sale

eBook

  • Your Price: $38.39
  • List Price: $47.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Acrobat® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

About

Features

  • Shows detailed sample code on how to implement advanced features
  • Helps new iOS developers easily take the next steps in iOS after learning the basics
  • Teaches various tips and insider tricks to improve performance and customize applications

Description

  • Copyright 2015
  • Dimensions: 7" x 9"
  • Edition: 2nd
  • Book
  • ISBN-10: 0-13-405249-8
  • ISBN-13: 978-0-13-405249-6

Apple’s iOS SDK provides an amazingly powerful collection of frameworks. But it has been difficult to find detailed and useful knowledge about them–until now. With this book’s practical insights and tested code, you can use Apple’s frameworks to create apps that are more innovative and usable…faster and more reliable…more successful and profitable.


Kyle Richter and Joe Keeley focus on intermediate-to-advanced techniques that professional iOS developers can use every day. Their far-reaching coverage ranges from social support to security, Core Data to iCloud–even Apple Watch.


Organized as a convenient modular reference, nearly every chapter contains a complete Objective-C sample project. A multi-chapter Game Center case study shows how multiple iOS features can be combined to do even more.

All source code may be downloaded at https://github.com/dfsw/icf.

Coverage includes:

  • Adding physics-like animation and behaviors to UIViews
  • Using Core Location to determine device location, display customized maps, and implement geofencing
  • Making games and apps social with Leaderboards
  • Accessing music and image collections
  • Building health/fitness apps with HealthKit
  • Integrating with home automation via HomeKit
  • Passing data between platforms using JSON
  • Setting up local and remote notifications
  • Remotely storing and syncing data with CloudKit
  • Accessing app functionality with extensions
  • Effortlessly adding AirPrint support
  • Providing Handoff continuity between iOS 8 and Yosemite devices
  • Getting productive with Core Data
  • Integrating Twitter and Facebook via Social Framework
  • Performing resource-intensive tasks with Grand Central Dispatch
  • Securing user data with Keychain and Touch ID
  • Customizing collection views
  • Making the most of gesture recognizers
  • Creating and distributing “passes”
  • Debugging, instrumenting, and profiling apps

Extras

Related Article

Know Your Tools to Build Better iOS Apps

Companion Site

Please visit the website associated with Mastering iOS Frameworks to access the source code here.

Sample Content

Online Sample Chapter

Mastering iOS Frameworks: Working with and Parsing JSON

Excerpt

Preface to Mastering iOS Frameworks: Beyond the Basics, Second Edition

Sample Pages

Download the sample pages (includes Chapter 9 and Index)

Table of Contents

1 UIKit Dynamics     1
The Sample App     1
Introduction to UIKit Dynamics     2
Implementing UIKit Dynamics     3
    Gravity     3
    Collisions     4
    Attachments     7
    Springs     8
    Snap     9
    Push Forces     10
    Item Properties     11
In-Depth UIDynamicAnimator and UIDynamicAnimatorDelegate     13
Summary     14


2 Core Location, MapKit, and Geofencing     15
The Sample App     15
Obtaining User Location     16
    Requirements and Permissions     16
    Checking for Services     19
    Starting Location Request     19
    Parsing and Understanding Location Data     22
    Significant Change Notifications     23
    Using GPX Files to Test Specific Locations     23
Displaying Maps     25
    Understanding the Coordinate Systems     25
    MKMapKit Configuration and Customization     25
    Responding to User Interactions     27
Map Annotations and Overlays     28
    Adding Annotations     28
    Displaying Standard and Custom Annotation Views     31
    Draggable Annotation Views     34
    Working with Map Overlays     35
Geocoding and Reverse-Geocoding     36
    Geocoding an Address    36
    Reverse-Geocoding a Location     40
Geofencing     43
    Checking for Regional Monitoring Capability     43
    Defining Boundaries     44
    Monitoring Changes     45
Getting Directions     47
Summary     52


3 Leaderboards     53
The Sample App     53
    Spawning a Cactus     55
    Cactus Interaction     58
    Displaying Life and Score     60
    Pausing and Resuming     62
    Final Thoughts on Whack-a-Cac     63
iTunes Connect     63
Game Center Manager     66
Authenticating     68
    Common Authentication Errors     69
    iOS 6 and Newer Authentication     71
Submitting Scores     73
    Adding Scores to Whack-a-Cac     76
    Presenting Leaderboards     77
    Score Challenges     79
    Going Further with Leaderboards     81
Summary     83


4 Achievements     85
iTunes Connect     85
Displaying Achievement Progress     87
Game Center Manager and Authentication     88
The Achievement Cache     89
Reporting Achievements     90
Adding Achievement Hooks     92
Completion Banners     93
Achievement Challenges     94
Adding Achievements into Whack-a-Cac     97
    Earned or Unearned Achievements     98
    Partially Earned Achievements     99
    Multiple Session Achievements     101
    Piggybacked Achievements and Storing Achievement Precision     102
    Timer-Based Achievements     103
Resetting Achievements     104
Going Further with Achievements     105
Summary     107


5 Getting Started with Address Book     109
Why Address Book Support Is Important     109
Limitations of Address Book Programming     110
The Sample App     110
Getting Address Book Up and Running     111
    Reading Data from the Address Book     113
    Reading Multivalues from the Address Book     114
    Understanding Address Book Labels     115
    Working with Addresses     116
Address Book Graphical User Interface     118
    People Picker     118
Programmatically Creating Contacts     123
Summary     126


6 Working with Music Libraries     127
The Sample App     127
Building a Playback Engine     129
    Registering for Playback Notifications     129
    User Controls     131
    Handling State Changes     132
    Duration and Timers     137
    Shuffle and Repeat     138
Media Picker     138
Programmatic Picker     141
    Playing a Random Song     141
    Predicate Song Matching     142
Summary     144


7 Implementing HealthKit     145
Introduction to HealthKit     145
Introduction to Health.app     146
The Sample App     147
Adding HealthKit to a Project         148
Requesting Permission for Health Data     149
Reading Characteristic HealthKit Data     152
Reading and Writing Basic HealthKit Data     152
Reading and Writing Complex HealthKit Data     155
Summary     160


8 Implementing HomeKit     161
The Sample App     161
Introduction to HomeKit     162
Setting Up HomeKit Components     162
    Developer Account Setup     163
    Enabling HomeKit Capability     163
    Home Manager     164
    Home     166
    Rooms and Zones     168
    Accessories     170
    Services and Service Groups     176
    Actions and Action Sets     178
Testing with the HomeKit Accessory Simulator     179
Scheduling Actions with Triggers     181
Summary     181


9 Working with and Parsing JSON     183
JSON     183
    Benefits of Using JSON     183
    JSON Resources     184
The Sample App     184
Accessing the Server     184
Getting JSON from the Server     185
    Building the Request     185
    Inspecting the Response     186
    Parsing JSON     186
    Displaying the Data     187
Posting a Message     189
    Encoding JSON     189
    Sending JSON to the Server     191
Summary     193


10 Notifications     195
Differences Between Local and Push Notifications     195
The Sample App     196
App Setup     196
Creating Development Push SSL Certificate     200
Development Provisioning Profile     203
Custom Sound Preparation     208
Registering for Notifications     209
Scheduling Local Notifications     211
Receiving Notifications     212
Push Notification Server     213
Sending the Push Notifications     214
Handling APNs Feedback     215
Summary     216


11 Cloud Persistence with CloudKit     217
CloudKit Basics     217
The Sample App     218
Setting Up a CloudKit Project     218
    Account Setup     218
    Enabling iCloud Capabilities     220
CloudKit Concepts     220
    Containers     220
    Databases     221
    Records     221
    Record Zones     222
    Record Identifiers     222
    Assets     222
CloudKit Basic Operations     222
    Fetching Records     223
    Create and Save a Record     224
    Update and Save a Record     226
Subscriptions and Push     227
    Push Setup     227
    Subscribing to Data Changes     227
User Discovery and Management     229
Managing Data in the Dashboard     233
Summary     235


12 Extensions     237
Types of Extensions     237
    Today     237
    Share     238
    Action     238
    Photo Editing     238
    Document Provider     238
    Custom Keyboard     238
Understanding Extensions     238
API Limitations     239
Creating Extensions     240
Today Extension     242
Sharing Code and Information between Host App and Extension     243
Apple Watch Extension     244
Summary     247


13 Handoff     249
The Sample App     249
Handoff Basics     249
Implementing Handoff     251
    Creating the User Activity     252
    Continuing an Activity     253
Implementing Handoff in Document-Based Apps     255
Summary     257


14 AirPrint     259
AirPrint Printers     259
Testing for AirPrint     261
Printing Text     261
    Print Info     262
    Setting Page Range     263
    UISimpleTextPrintFormatter     263
    Error Handling     264
    Starting the Print Job     264
    Printer Simulator Feedback     265
Print Center     266
    UIPrintInteractionControllerDelegate     267
Printing Rendered HTML     268
Printing PDFs     269
Summary     270


15 Getting Up and Running with Core Data     271
Deciding on Core Data     272
Sample App     273
Starting a Core Data Project     274
    Core Data Environment     275
Building Your Managed Object Model     278
    Creating an Entity     280
    Adding Attributes     280
    Establishing Relationships     281
    Custom Managed Object Subclasses     282
Setting Up Default Data     282
    Inserting New Managed Objects     282
    Other Default Data Setup Techniques     284
Displaying Your Managed Objects     285
    Creating Your Fetch Request     285
    Fetching by Object ID     287
    Displaying Your Object Data     288
    Using Predicates     290
Introducing the Fetched Results Controller     292
    Preparing the Fetched Results Controller     292
    Integrating Table View and Fetched Results Controller     294
    Responding to Core Data Changes     296
Adding, Editing, and Removing Managed Objects     299
    Inserting a New Managed Object     299
    Removing a Managed Object     300
    Editing an Existing Managed Object     301
    Saving and Rolling Back Your Changes     301
Summary     303


16 Integrating Twitter and Facebook Using Social Framework     305
The Sample App     305
Logging In     306
Using SLComposeViewController     308
Posting with a Custom Interface     311
    Posting to Twitter     311
    Posting to Facebook     315
    Creating a Facebook App     315
Accessing User Timelines     322
    Twitter     322
    Facebook     327
Summary     331


17 Working with Background Tasks     333
The Sample App     334
Checking for Background Availability     334
Finishing a Task in the Background     335
    Background Task Identifier     336
    Expiration Handler     337
    Completing the Background Task     337
Implementing Background Activities     339
    Types of Background Activities     339
    Playing Music in the Background     340
Summary     344


18 Grand Central Dispatch for Performance     345
The Sample App     345
Introduction to Queues     347
Running on the Main Thread     347
Running in the Background     349
Running in an Operation Queue     351
    Concurrent Operations     351
    Serial Operations     353
    Canceling Operations     354
    Custom Operations     355
Running in a Dispatch Queue     357
    Concurrent Dispatch Queues     357
    Serial Dispatch Queues     359
Summary     361


19 Using Keychain and Touch ID to Secure and Access Data     363
The Sample App     364
Setting Up and Using Keychain     364
    Setting Up a New KeychainItemWrapper     365
    Storing and Retrieving the PIN     366
    Keychain Attribute Keys     367
    Securing a Dictionary     368
    Resetting a Keychain Item     370
    Sharing a Keychain Between Apps     370
    Keychain Error Codes     372
Implementing Touch ID     372
Summary     374


20 Working with Images and Filters     375
The Sample App     375
Basic Image Data and Display     376
    Instantiating an Image     376
    Displaying an Image     377
    Using the Image Picker     379
    Resizing an Image     382
Core Image Filters     383
    Filter Categories and Filters     383
    Filter Attributes     386
    Initializing an Image     388
    Rendering a Filtered Image     389
    Chaining Filters     390
Feature Detection     391
    Setting Up a Face Detector     391
    Processing Face Features     392
Summary     394


21 Collection Views     395
The Sample App     395
Introducing Collection Views     396
    Setting Up a Collection View     397
    Implementing the Collection View Data Source Methods     398
    Implementing the Collection View Delegate Methods     401
Customizing Collection View and Flow Layout     403
    Basic Customizations     403
    Decoration Views     405
Creating Custom Layouts     408
Collection View Animations     413
    Collection View Layout Changes     413
    Collection View Layout Animations     414
    Collection View Change Animations     416
Summary     417


22 Introduction to TextKit     419
The Sample App     420
Introducing NSLayoutManager     420
Detecting Links Dynamically     423
Detecting Hits     424
Exclusion Paths     425
Content Specific Highlighting     427
Changing Font Settings with Dynamic Type     432
Summary     433


23 Gesture Recognizers     435
Types of Gesture Recognizers     435
Basic Gesture Recognizer Usage     436
Introduction to the Sample App     437
    Tap Recognizer in Action     438
    Pinch Recognizer in Action     440
Multiple Recognizers for a View     441
    Gesture Recognizers: Under the Hood     443
    Multiple Recognizers for a View: Redux     444
    Requiring Gesture Recognizer Failures     446
Custom UIGestureRecognizer Subclasses     448
Summary     448


24 Accessing the Photo Library     449
The Sample App     449
The Photos Framework     450
Using Asset Collections and Assets     451
    Permissions     451
    Asset Collections     453
    Assets     457
Changes in the Photo Library     459
    Asset Collection Changes     459
    Asset Changes     462
Dealing with Photo Stream     464
Summary     465


25 Passbook and PassKit     467
The Sample App     468
Designing the Pass     468
    Pass Types     469
    Pass Layout–Boarding Pass     469
    Pass Layout–Coupon     470
    Pass Layout–Event     471
    Pass Layout–Generic     471
    Pass Layout–Store Card     472
    Pass Presentation     473
Building the Pass     474
    Basic Pass Identification     476
    Pass Relevance Information     476
    Barcode Identification     477
    Pass Visual Appearance Information     478
    Pass Fields     478
Signing and Packaging the Pass     481
    Creating the Pass Type ID     481
    Creating the Pass Signing Certificate     483
    Creating the Manifest     488
    Signing and Packaging the Pass     489
    Testing the Pass     489
    Interacting with Passes in an App     491
Updating Passes Automatically     501
Summary     502


26 Debugging and Instruments     503
Introduction to Debugging     503
    The First Computer Bug     504
    Debugging Basics with Xcode     504
Breakpoints     506
    Customizing Breakpoints     507
    Symbolic and Exception Breakpoints     508
    Breakpoint Scope     508
Working with the Debugger     509
Instruments     510
    The Instruments Interface     512
    Exploring Instruments: The Time Profiler     514
    Exploring Instruments: Leaks     516
    Going Further with Instruments     519
Summary     519

Index     521

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020