Topic: Mobile

Professional iOS Programming (1118661133) cover image

Professional iOS Programming

Peter van de Put, Pertti Karjlainen (Foreword by)
ISBN: 978-1-118-66113-0
Paperback
576 pages
December 2013
This title is out-of-print and not currently available for purchase from this site.
About This Title  |  Download Code  |  Errata  |  P2P Forum for This Title
Foreword xix

Introduction xxi

Part I: Developing a Professional UI

Chapter 1: Creating a Personal Library 3

Creating Your Personal Library 4

Understanding Project Basics 4

Starting a New Project 5

Configuring Your Project 6

Defining Constants 8

Using the Configuration 8

Importing the Header File 10

Registration—Login 11

Creating Registration Logic 12

Initializing Data 15

Initializing Application Defaults 15

Creating Login Logic 16

Securing Passwords 18

Storing the Password in a Keychain 20

Crash Management 20

Understanding Crashes 21

Implementing a Crash Handler 21

Summary 28

Chapter 2: Advancing with Tableviews 29

Understanding the UITableView 29

datasource and delegate 30

Scrolling 34

Building a Chat View Controller 38

Building a datasource 39

Building a Chat Data Object 39

Building a Custom UITableView 42

Flexible Cell Height 45

Developing Custom Cells 46

Creating the Chat User Object 49

Putting It All Together 50

Drilling Down with UITableView 56

Implementing a UISearchBar 66

Adding an Alphabet Index 72

Summary 77

Chapter 3: Advancing with Map Kit 79

Simulating iOS Device Movement 80

Why You Need a GPS Simulator 80

Creating the Simulator 80

Creating a GPS Route File with Google Maps 84

Implementing the YDLocationSimulator 87

Working with Annotations 90

Creating Custom Annotations 90

Responding to Annotation Call-Outs 95

Clustering Annotations 100

Summary 118

Chapter 4: Understanding Action Views and Alerts 119

Asking for User Input 119

Creating a UIActionSheet with Multiple Options 120

Presenting the UIActionSheet 125

Responding to User Input 133

Processing the User Selection 133

Extending the UIAlertView 136

Adding a UITextField to a UIAlertView 136

Summary 140

Chapter 5: Internationalization: Building Apps for the World 141

Localizing Your Application 141

Setting Up Localization 143

Localizing Interface Builder Files 144

Localizing Strings 145

Localizing Images 148

Localize the Name of Your Application 150

Working with Date Formats 151

What Is a Locale? 151

Understanding Calendars 155

Storing Dates in a Generic Way 159

Working with Numbers 160

Introducing Number Formatters 160

Summary 164

Chapter 6: Using Multimedia 165

Portable Document Format 165

Displaying a PDF Document with a UIWebView 166

Displaying a PDF Document using QuickLook 170

Creating a Thumbnail from a PDF Document 173

Creating a PDF Document 177

Playing and Recording Audio 181

Introduction to the Frameworks 182

Playing an Audio File from the Bundle 182

Playing Audio from Your iTunes Library 187

Playing Streaming Audio 191

Recording Audio 193

Playing and Recording Video 198

Playing a Video File from the Bundle 199

Playing a Video from Your iTunes Library 202

Playing a YouTube Video 205

Recording Video 207

Summary 210

Part II: Networking–Data Processing

Chapter 7: Using Web Services and Parsing 213

Why Would You Need to Use a Web Service? 213

Understanding Basic Networking 214

Understanding Protocols 214

Understanding Operations 215

Understanding Response Codes 215

Introduction to Web Services 216

Calling an HTTP Service 216

Requesting a Website 216

Downloading an Image from an HTTP URL 219

Requesting a Secure Website Using HTTPS 225

Using Blocks 228

Calling a REST Service 232

Constructing Your Request 232

Processing the Response 236

Posting to a RESTful Service 242

Making SOAP Requests 248

Preparing Your Request 250

Passing Values to an Operation 252

Understanding Secure SOAP Requests 258

More Parsing 260

What about Comma-Separated Value Files? 260

Transforming XML to an NSDictionary 266

Summary 270

Chapter 8: Using FTP 271

Developing an FTP Client 272

Writing a Simple FTP Client 272

Downloading a Remote File 277

Creating a Remote Directory 279

Listing a Remote Directory 280

Uploading a File 283

Reading from an NSStream 284

Writing to an NSStream 285

Writing a Complex FTP Client 288

Working with an FTP Client 297

Summary 297

Chapter 9: Implementing Core Data 299

Introduction to Core Data 299

Why Should You Use Core Data? 300

Introducing Managed Object Context 300

Introducing the Managed Object Model 300

Introducing Managed Objects 301

Introducing Persistent Stores 301

Introducing Fetch Requests 301

Using Core Data in Your Application 302

Creating a Managed Object Model 302

Creating Managed Objects 305

Creating Persistent Stores 306

Setting Up Your Appdelegate 307

Using Core Data in Your Application 309

Using Managed Objects 309

Fetching Managed Objects 311

Using Relationships 316

Understanding Model Changes 320

Tuning for Performance 324

Concurrency with Core Data 331

Summary 332

Part III: Integrating Your App

Chapter 10: Notifications 335

Implementing Local Notifications 336

Understanding Local Notifications 336

Creating a Notification 337

Receiving a Notification 340

Understanding Push Notifications 341

Configuring the Developer Portal 343

Obtaining Certificates 346

Implementation with Urban Airship 349

External Notifications 352

Defining a Custom URL Scheme 352

Responding to the URL Request 353

Summary 354

Chapter 11: Sending E‑Mail, SMS, and Dialing a Phone 355

Sending E‑Mail 355

Composing an E‑Mail 356

Working with Attachments 358

Sending SMS (Text Message) 359

Verifying if SMS Is Available 359

Composing a Text Message 359

Dialing a Phone Number 360

Verifying Dialing Capability 360

Summary 361

Chapter 12: Understanding the Address Book 363

Introduction to the Address Book Framework 363

Accessing the Address Book 364

Selecting a Contact 364

Requesting Access Permission 367

Displaying and Editing a Contact 370

Creating a Contact 373

Deleting a Contact 375

Programmatically Accessing the Address Book 375

Understanding Address Books 376

Understanding Records 379

Understanding Properties 380

Creating a Contact Programmatically 381

Deleting a Contact Programmatically 384

Summary 384

Chapter 13: Event Programming 385

Introduction to the Event Kit Framework 385

Using the EventKitUI Framework 386

Requesting Access Permission 386

Accessing a Calendar 388

Creating and Editing a Calendar Event 390

Programmatically Accessing the Calendar Database 391

Creating an Event 392

Editing an Event 396

Deleting an Event 397

Stay Synchronized 397

Working with Reminders 397

Creating a Reminder 398

Editing a Reminder 399

Deleting a Reminder 399

Working with Alarms 399

Summary 401

Chapter 14: Integrating with Social Media 403

Introduction to Social Media Integration 403

Understanding the Accounts Framework 404

Understanding the Social Framework 408

Making a Post 409

Retrieving Tweets 418

Integrating with Facebook 419

Creating a Single Sign-In Application 426

Summary 431

Part IV: Taking Your Application to Production

Chapter 15: Analyzing Your Application 435

Performing a Technical Analysis 435

Application Crashes 436

Blocking the Main Thread 436

Memory Leaks 437

Using Synchronized HTTP Requests 438

Extensive Bandwidth Usage 438

Battery Drainage 442

Bad User Interface 444

Performing a Commercial Analysis 444

Introducing Flurry Analytics 445

Summary 446

Chapter 16: Monetize Your App 447

Introduction to Monetizing 447

Paid Application 448

Advertising 448

In-App Purchases 448

Subscriptions 448

Lead Generation 449

Affiliate Sales 449

Developing In-App Purchases 449

Introduction to In-App Purchase 449

Registering Products 450

Choosing the Product Type 450

Understanding the In-App Purchase Process 451

Implementing an In-App Purchase 452

Monetizing with Advertisements 473

Introducing the iAd Framework 473

Implementing the AdMob Network 476

Summary 479

Chapter 17: Understanding iTunes Connect 481

IOS Developer Member Center 482

Obtaining a Developer Certificate 482

Managing Devices 486

Managing Apps 489

Creating a Development Provisioning Profile 496

Creating a Distribution Provisioning Profile 499

Summary 503

Chapter 18: Building and Distribution 505

App Store Review 505

Understanding the Review Guidelines 506

Understanding the Review Process 506

Understanding Rejections 509

Avoiding Common Pitfalls 509

Building for Ad Hoc Distribution 510

Building Your Application 510

Distribute for Testing 512

Building for App Store Distribution 514

Summary 521

Appendix a: Audio Codes 523

Appendix b: Artwork Dimensions 527

Device Dimensions 527

iTunes Connect Artwork Dimensions 529

Index 531