Beginning iOS Programming For Dummies - Rajiv Ramnath - E-Book

Beginning iOS Programming For Dummies E-Book

Rajiv Ramnath

0,0
20,99 €

oder
-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

The ultimate beginner's guide to programming in the iOS environment The Apple App Store is a gold mine for developers, but with more apps for the iPhone, iPad, and iPod touch being added every day, it?s essential to have a solid programming foundation to create the best apps possible. If you're eager to learn the ins and outs of iOS programming, this is your book. It teaches object-oriented programming within the iOS framework from the ground up, preparing you to create the next super iPhone or iPad app. Get a handle on the iOS framework, object-oriented best practices, and the Xcode programming environment, then discover how to create simple interfaces, use libraries, create and extend objects, and more. Whether you're just starting out in programming or only new to iOS, For Dummies is the perfect beginning. * Focuses on teaching object-oriented programming within the iOS framework and includes best practices for building apps that are easy to debug, evolve, and maintain * Uses simple examples to demonstrate object-oriented programming output in the iPhone environment while teaching real-world programming concepts and applications * Provides a thorough understanding of the framework and object-oriented principles to help beginning programmers make optimum use of iOS * Covers working with the Xcode environment and storyboards; creating simple interfaces; using libraries, functions, structures, arrays, and pointers; and creating and extending objects Beginning iOS Programming For Dummies is your straightforward guide to getting started with iOS programming.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 506

Veröffentlichungsjahr: 2014

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Beginning iOS Programming For Dummies®

Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com

Copyright © 2014 by John Wiley & Sons, Inc., Hoboken, New Jersey

Media and software compilation copyright © 2014 by John Wiley & Sons, Inc. All rights reserved.

Published simultaneously in Canada

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.

Trademarks: Wiley, For Dummies, the Dummies Man logo, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY:THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.

For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit www.wiley.com/techsupport.

Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.

Library of Congress Control Number: 2013954213

ISBN 978-1-118-79927--7 (pbk); ISBN 978-1-118-79931-4 (ebk); ISBN 978-1-118-79932-1 (ebk)

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

Beginning iOS Programming For Dummies

Visit www.dummies.com/cheatsheet/beginningiosprogramming to view this book's cheat sheet.

Table of Contents

Introduction

About This Book

Foolish Assumptions

Icons Used in This Book

Beyond the Book

Part I: Getting Started with iOS Programming

Chapter 1: Entering Mobile Application Development

Apps for a Mobile Platform

iOS Benefits

iOS App Development Essentials

Devices

Application development technologies

Xcode

The Application Model

Understanding the lifecycle of an iOS app

Understanding the structure of an iOS app

Object-Orientation Concepts

Chapter 2: Object-Oriented Design Principles

Basic Object-Oriented Concepts

Designing programs

Structural and behavioral concepts in OO

Principles of Object-Orientation

Coupling

Cohesion

Designing an Object-Oriented Application

Advanced OO Techniques

Delayed binding

Delegation

Design patterns

Inversion of control and software frameworks

The Application Development Lifecycle

Software development lifecycle processes

The phases and stages of a software development lifecycle (SDLC)

The guiding principles of SDLC methodologies

Customizing an SDLC methodology

Chapter 3: Effectively Using Objective-C

Examining an Objective-C Program

Defining Classes

Declaring instance variables

Declaring methods

Using forward references

Implementing classes

Using Classes, Objects, Methods, and Variables

Invoking methods

Creating objects

Using all the language features

Using introspection and dynamic invocation

Managing Memory

Handling Exceptions

Organizing Program Files

Analyzing Objective-C’s Object-Orientation Capabilities

Part II: Meeting the Methods and Platforms

Chapter 4: Patterns and Frameworks

Common Patterns of OO Design

Seeing basic design patterns

Understanding the Model-View-Controller

Making model objects persistent

Avoiding anti-patterns

Applying patterns to application design

Understanding Frameworks

Inversion of control

Basic concepts

Flow of control

Chapter 5: Setting Up to Develop iOS Apps

Becoming an iOS Developer

Installing, Verifying, and Understanding the Xcode Development Environment

Installing Xcode

Verifying the development environment

Understanding the elements of an Xcode workspace

Importing and Running the Tic-Tac-Toe Sample Program

Importing Tic-Tac-Toe and running it on the simulator

Deploying an App on an iOS device

Chapter 6: Developing an App on iOS

Dissecting an iOS App

Understanding an App’s Lifecycle

Interacting with the App Through Its User Interface

Dealing with Data

Using JSON

Saving data using files

Moving up to Core Data

Accessing the Address Book

Setting options for your app

Sharing data across apps

Using Other iOS Capabilities on a Device

Visiting the App Templates in Xcode

Deconstructing the iOS Framework Using OO Principles and Design Patterns

Seeing object-oriented concepts and techniques in iOS

Seeing patterns in iOS

Critiquing the iOS framework from the perspective of OO principles

Chapter 7: Illustrating Object-Oriented iOS App Design

Customizing an SDLC for iOS App Development

Developing Use Cases

Creating the User Interface

Illustrating Object-Oriented Design

Classes and responsibilities

Collaborators and missing classes and responsibilities

Contracts and signatures

Implementing an Object-Oriented Design on iOS

Implementing the model

Creating storyboards and views

Making the app active

Analyzing the OO and Design Principles Used in Tic-Tac-Toe

Use of design patterns in Tic-Tac-Toe

Other concepts

Part III: Making Your iOS Apps Fit for Consumption

Chapter 8: Effectively Using Xcode

Xcode and IOS — A Beautiful Friendship

Setting up your app’s project

Creating your app’s screen flow

Writing your app’s code

Managing and maintaining your app’s components

Fine-Tuning Your App in Xcode

Configuring your app

Digging into the Simulator

Exploring your iOS device from Xcode

Debugging your app

Using instruments to collect data

Getting Help

Chapter 9: Developing Your App’s User Interface

Understanding How User Interfaces Work in iOS

Comprehending event-driven programming in iOS

Understanding the Application and the Application Delegate objects in UI processing

Revisiting the Model-View-Controller Design Pattern

Understanding the UI Components Available in iOS

Interacting with buttons, text fields, and labels

Alerting the user

Selecting items using pickers

Showing columnar data using a Table view

Going through the other views in the iOS framework

Navigating through a stack of screens using a Navigation controller

Drawing using 2-D Graphics

Chapter 10: Making Applications Fast and Responsive

Becoming Familiar with Nonfunctional Requirements

Designing Your App at Multiple Levels

Optimizing an Application's Performance

Using Instrumentation for Code Optimization

Ensuring Responsiveness in Your Apps

Ensuring responsiveness by using threading

Other Performance Considerations for iOS Apps

Chapter 11: Making Your App Reliable and Secure

Making Your App Reliable Through Testing

Understanding the fundamentals and levels of testing

Understanding the levels of testing

Using automated testing

Adapting to Changes in the App’s Environment

Implementing reliability while navigating your app’s lifecycle

Dealing with missing or transient capabilities

Considering Security in an iOS App

Recognizing the importance of security

Looking at security holistically

Understanding the attack surface and developing a threat model for an app

Implementing authentication and access control

Protecting core data files with encryption

Adding auditing to your application

Part IV: Connecting Your Apps

Chapter 12: Channeling the World Into Your Device

Networking Basics

Launching a browser from your app

Embedding a browser in your iOS application using WebView

Using Maps and Providing Location-Based Services

Installing the additional development components needed for maps

Displaying a map using a MapView

Using geocoding to navigate the map

Wherever you go, there you are

Design Principles for Web- and Location-Based Apps

Being nice about using remote services

Using threading to deal with slow network connections

Chapter 13: Harnessing iOS Device Capabilities

Integrating E-Mail, SMS, and the Phone into Your App

Sending e-mail from your app

Sending an SMS from your app

Placing telephone calls from your app

Playing and Capturing Audio, Video, and Images

Playing and recording video

Playing and recording audio

Working with images

Seeing the Capabilities Available on Your Device

Testing for network availability

Testing for sound and camera capabilities

Declaring an app's needs in the .plist file

Bringing in the Outside World with Sensors

Sensing orientation

Sensing the accelerometer, gyroscope, and magnetometer

Examining OO and Other Design Principles in this Chapter

Seeing uses of loose coupling

Using delegation for customized processing

Using design patterns

Design tradeoffs in Tic-Tac-Toe

Chapter 14: Publishing to the App Store

Creating Your Developer Account

Distributing Applications

Providing basic application details

Special capabilities

Internationalization and localization

Testing

iOS devices

Beta testing

Submitting Your App

Using iTunes Connect

Uploading to the App Store

Supporting Your App

Marketing

Sales data and customer feedback

Publishing updates

Part V: The Part of Tens

Chapter 15: Ten Resources for Object-Oriented Development

Design Patterns: Elements of Reusable Object-Oriented Software

martinfowler.com

Object-Oriented Programming with Objective-C

The Journal of Object Technology

Massively Open Online Courses (MOOCs)

Ambysoft

Craig Larman's Use Case Primer

uml.org

Agile Alliance

Rajiv's YouTube Video Series

Chapter 16: Ten Developer Resources for iOS

iOS Dev Center

Apple Worldwide Developers Conference

iOS Dev Weekly

raywenderlich

AppCoda

Stack Overflow

iPhoneDevSDK

pttrns

Cocoa Controls

MacRumors

About the Author

Cheat Sheet

More Dummies Products

Guide

Table of Contents

Begin Reading

Pages

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

413

414

415

416

417

418

419

420

421

422

439

440

441

Introduction

Although iOS powers only about 13 percent of the smartphones used by people in the U.S., its use increases to 55 percent when you consider traffic over the Internet — because iOS devices are bought by people who use their devices frequently. In addition to its loyal users, iOS comes with a well-designed Objective-C–based SDK with rich functionality that makes developing apps straightforward and fun. In other words, iOS is a perfect target market for an innovative app developer. With that, welcome to this book.

About This Book

This book guides you through the iOS SDK and how to build high-quality applications using it. It focuses on iOS 7 and Xcode version 5 and is of significant value to software developers, regardless of their level of experience.

If you're a software developer and want to understand how to apply object-oriented concepts, techniques, and principles to iOS development, this book is for you.If you're a software developer and have developed other kinds applications but not those for mobile devices, don’t worry. This book is a mobile applications primer that deals with resource conservation, network disconnection, change in location, hardware-software interaction, and more.If you're a software developer with experience in developing mobile applications and want to develop an equivalent iOS application (such as iPhone), you'll probably quickly understand the iOS programming model and then navigate on to the chapters you're most interested in.

Here are some of the conventions you will see in the book:

Code examples: These appear in a fixed-width font so that they stand out, as illustrated here:

[self initializeGameSession];

Short URLs: These appear in a monotype font as follows:

https://developer.apple.com

Extras and updates: For long URLs, I refer you to the book's website (for example: "To find out more about windows and views, go to www.dummies.com/go/iosprogramminglinks and check out the Windows and Views link in the web resources for this chapter." Also, I will continue to provide updates for the code and post other things you might find useful on the book’s website.Sidebars and technical information: You'll find sidebars and technical information (the latter, flagged by a TechnicalStuff icon), which you can either read at your leisure or skip, though you may find them too interesting to skip.Cheat Sheet: An online resource that points you to facts, fast.

You can read this book one of three ways:

You can read it from cover to cover. If this book is your first real exposure to iOS terminology, concepts, and technology, this method is probably the way to go.If you want to jump right into reading about object-oriented iOS app development and then come back to the actual how-to details, turn to Chapters 6 and 7; then read the other chapters as needed.Use this book as a reference. Read selected chapters or sections of particular interest to you in any order you choose. The chapters have been written to stand on their own as much as possible.

The chapters that delve into the capabilities of iOS are organized into two broad parts. The first part is a “how-to” section that describes various capabilities and provides lots of examples. The second part examines the capabilities from an object-oriented perspective.

When you finish this book, you'll know how to build appealing and engaging iOS apps. You'll know how to make high-quality apps fit for both enterprise and consumer markets. Your apps will be bug-free, and they'll perform well, even in stressful situations, such as during a network failure or when a device is running out of power.

Foolish Assumptions

The common denominator for those reading this book is an interest in developing high-quality apps for iOS. Also, because Objective-C is layered on C, I assume you're comfortable with C. (This book doesn't cover C; however, if you aren't familiar with it, I recommend a couple resources you can find on the web.)

I also assume that you've used at least one integrated development environment (IDE) to develop software so that Xcode isn't a complete surprise. That said, I cover Xcode in two chapters. Chapter 5 gets you started with Xcode, and Chapter 8 delves into more detail.

Icons Used in This Book

A few icons mark paragraphs that have special value.

The Remember icon identifies useful information that is worth remembering. (You have a copy of the book, so there's no special need to commit the whole book to memory. For most stuff, you can look it up when you need it.)

Some things are interesting, but not important for the sake of getting the job done. You can skip the Technical Stuff if you want.

A Tip can save you time or make your application better.

Watch out! You see a Warning when there's a pitfall ahead.

Beyond the Book

A lot of extra content that is not in this book is available at www.dummies.com. Go online to find the following:

Online articles covering additional topics at

www.dummies.com/extras/beginningiosprogramming

The Cheat Sheet for this book is at

www.dummies.com/cheatsheet/beginningiosprogramming

Updates to this book, if we have any, are also available at

www.dummies.com/extras/beginningiosprogramming

Part I

Getting Started with iOS Programming

Visit www.dummies.com for great Dummies content online.

In this part …

Essential application development guidelinesThe application modelBasic design principlesAdvanced techniquesUsing classes, objects, methods, and variablesVisit www.dummies.com for great Dummies content online.

Chapter 1

Entering Mobile Application Development

In This Chapter

Identifying the market

Following the design process

Entering the world of object-oriented development

Mobile devices are everywhere. These smartphones and tablets run powerful applications and are making a difference in how people live, work, and play.

Many folks already use these devices as they do computers: to create and edit documents; to interact with others via e-mail, telephone, and chat; to play highly entertaining games; and to shop and manage money. Even schools, which used to ban cellphones in the classroom, are considering delivering educational materials to students via smartphones. Because they're common and robust, tablets and smartphones are now the primary computing and communication devices for many people.

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!