P. 1
iPhone App Programming Guide

iPhone App Programming Guide

|Views: 281|Likes:
Published by Lukasz81

More info:

Published by: Lukasz81 on Aug 22, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less






  • Understanding the iOS Runtime Environment
  • Designing the Core of Your Application
  • Supporting Common Application Behaviors
  • Executing Code in the Background
  • Meeting the App Store and System Requirements
  • Tuning Performance for the Underlying Device
  • See Also
  • Fast Launch, Short Use
  • Specialized System Behaviors
  • The Virtual Memory System
  • The Application Runtime Environment
  • The Automatic Sleep Timer
  • Multitasking Support
  • Security
  • The Application Sandbox
  • File Protection
  • Keychain Data
  • The File System
  • A Few Important Application Directories
  • Table1-1 Directories of an iOS application
  • A Case-Sensitive File System
  • Sharing Files with the User’s Desktop Computer
  • Backup and Restore
  • What Is Backed Up?
  • Files Saved During Application Updates
  • iOS Simulator
  • Determining the Available Hardware Support
  • Table1-2 Identifying available features
  • Fundamental Design Patterns
  • Table2-1 Design patterns used by iOS applications
  • The Core Application Design
  • The Core Application Objects
  • Figure2-1 Key objects in an iOS application
  • Table2-2 The role of objects in an iOS application
  • The Application Life Cycle
  • The main Function
  • Listing2-1 Themain function of an iOS application
  • The Application Delegate
  • Understanding an Application’s States and Transitions
  • Figure2-3 Launching into the active state
  • Figure2-4 Moving from the foreground to the background
  • Figure2-5 Handling application interruptions
  • Figure2-6 Transitioning from the background to the foreground
  • Multitasking
  • Checklist for Supporting Multitasking
  • Being a Responsible, Multitasking-Aware Application
  • Responding to System Changes While in the Background
  • Table2-4 Notifications delivered to waking applications
  • Opting Out of Background Execution
  • Windows, Views, and View Controllers
  • The Event-Handling System
  • Figure2-7 Processing events in the main run loop
  • The Graphics and Drawing System
  • The Text System
  • Figure2-8 Several different keyboards and input methods
  • Audio and Video Support
  • Integration with the Hardware and System Applications
  • Table2-5 System integration technologies
  • Preserving the State of Your Application’s User Interface
  • ImplementingCommonApplicationBehaviors
  • Launching in Landscape Mode
  • Files and the File System
  • Getting Paths to Standard Application Directories
  • Table3-1 Commonly used search path constants
  • Listing3-1 Getting the path to the application’sDocuments directory
  • Sharing Files with the User
  • Working with Protected Files
  • Marking a File as Protected
  • Opening Files Whose Type Is Unknown
  • Implementing Support for Custom File Formats
  • Listing3-2 Document type information for a custom file format
  • Communicating with Other Applications
  • Implementing Custom URL Schemes
  • Registering Custom URL Schemes
  • Table3-2 Keys and values of theCFBundleURLTypes property
  • Figure3-1 Defining a custom URL scheme in theInfo.plist file
  • Handling URL Requests
  • Listing3-3 Handling a URL request based on a custom scheme
  • Displaying Application Preferences
  • Turning Off Screen Locking
  • Determining Whether Multitasking Support is Available
  • Listing4-1 Checking for background support on earlier versions of iOS
  • Declaring the Background Tasks You Support
  • Implementing Long-Running Background Tasks
  • Tracking the User’s Location
  • Playing Background Audio
  • Implementing a VoIP Application
  • Table4-1 Configuring stream interfaces for VoIP usage
  • Completing a Finite Length Task in the Background
  • Listing4-2 Starting a background task at quit time
  • Scheduling the Delivery of Local Notifications
  • Listing4-3 Scheduling an alarm notification
  • The Settings Application Interface
  • Implementing Application Preferences
  • Table5-1 Preference control types
  • The Settings Bundle
  • Table5-2 Contents of theSettings.bundle directory
  • The Settings Page File Format
  • Table5-3 Root-level keys of a preferences Settings Page file
  • Hierarchical Preferences
  • Figure5-1 Organizing preferences using child panes
  • Localized Resources
  • Creating and Modifying the Settings Bundle
  • Adding the Settings Bundle
  • Preparing the Settings Page for Editing
  • Figure5-2 Formatted contents of theRoot.plist file
  • Configuring a Settings Page: A Tutorial
  • Creating Additional Settings Page Files
  • Accessing Your Preferences
  • Listing5-1 Accessing preference values in an application
  • Specifying Default Values for Preferences
  • Debugging Preferences for Simulated Applications
  • The Application Bundle
  • Build-Time Configuration Details
  • The Information Property List
  • Figure6-1 The information property list editor
  • Figure6-2 The Properties pane of a target’s Info window
  • iTunes Requirements
  • Declaring the Required Device Capabilities
  • Table6-2 Dictionary keys for theUIRequiredDeviceCapabilities key
  • Application Icons
  • Table6-3 Sizes for images in theCFBundleIconFiles key
  • Application Launch Images
  • Table6-4 Typical launch image dimensions
  • Providing Launch Images for Different Orientations
  • Table6-5 Launch image orientation modifiers
  • Providing Device-Specific Launch Images
  • Providing Launch Images for Custom URL Schemes
  • Creating a Universal Application
  • Configuring Your Xcode Project
  • Updating Your Info.plist Settings
  • Updating Your Views and View Controllers
  • Adding Runtime Checks for Newer Symbols
  • Using Runtime Checks to Create Conditional Code Paths
  • Updating Your Resource Files
  • Using a Single Xcode Project to Build Two Applications
  • Internationalizing Your Application
  • Figure6-3 The Language preference view
  • Do Not Block the Main Thread
  • Use Memory Efficiently
  • Tuning for Performance and Responsiveness
  • Observing Low-Memory Warnings
  • Reduce Your Application’s Memory Footprint
  • Table7-1 Tips for reducing your application’s memory footprint
  • Allocate Memory Wisely
  • Table7-2 Tips for allocating memory
  • Floating-Point Math Considerations
  • Reduce Power Consumption
  • Tune Your Code
  • Improve File Access Times
  • Tune Your Networking Code
  • Tips for Efficient Networking
  • Using Wi-Fi
  • The Airplane Mode Alert
  • Document Revision History

iOS comes with several applications for tuning the performance of your application. Most of these tools run
you can use the simulator to eliminate memory leaks and make sure your overall memory usage is as low as
algorithm or a previously unknown bottleneck.

Tune Your Code


2010-11-15 | © 2010 Apple Inc. All Rights Reserved.


Tuning for Performance and Responsiveness

After you have tuned your code in the simulator, you should then use the Instruments application to further
tune your code on a device. Running your code on an actual device is the only way to tune your code fully.
Because the simulator runs in Mac OS X, it has the advantage of a faster CPU and more usable memory, so
its performance is generally much better than the performance on an actual device. And using Instruments
to trace your code on an actual device may point out additional performance bottlenecks that need tuning.

For more information on using Instruments, see Instruments User Guide.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->