Slide 1

Slide 1 text

Introduction to iOS Software Development Adrian Kosmaczewski - akosma software OOP 2011

Slide 2

Slide 2 text

Adrian Kosmaczewski

Slide 3

Slide 3 text

http://www.flickr.com/photos/gi/164281467/

Slide 4

Slide 4 text

http://www.flickr.com/photos/jm3/379494322/

Slide 5

Slide 5 text

http://www.flickr.com/photos/21025851@N00/2168398185/

Slide 6

Slide 6 text

http://www.flickr.com/photos/emiliagarassino/2146648332/

Slide 7

Slide 7 text

akosma software

Slide 8

Slide 8 text

akosma.com github.com/akosma linkedin.com/in/akosma formspring.me/akosma twitter.com/akosma slideshare.com/akosma

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

iOS

Slide 13

Slide 13 text

http://www.flickr.com/photos/oskay/365607662/

Slide 14

Slide 14 text

http://www.flickr.com/photos/oskay/365607591/

Slide 15

Slide 15 text

http://www.flickr.com/photos/blakespot/2379207825/

Slide 16

Slide 16 text

http://www.flickr.com/photos/justdrew1985/4348527596/

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Some questions

Slide 19

Slide 19 text

iOS devices in the room?

Slide 20

Slide 20 text

Veteran NeXT or Mac OS X developers in the room?

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

Program History Objective-C Cocoa Tools Web vs. Native Apps The App Store Design Books Q&A

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

History

Slide 25

Slide 25 text

“Good design survives” Erich Gamma OOP 2011 Keynote

Slide 26

Slide 26 text

born in the 80s

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Objective-C

Slide 33

Slide 33 text

"Thin layer around C" Message-dispatch runtime built on C obj_msgSend() Static and dynamic (you choose) The “real” inspiration for Java: http://cs.gmu.edu/~sean/stuff/java-objc.html

Slide 34

Slide 34 text

Single inheritance + interfaces (“@protocols”) @protocols can have @optional methods Fields protected by default All methods are public, virtual and overridable Methods can be added to existing classes ("categories") Full introspection / reflection Messages can be intercepted and forwarded à la AOP

Slide 35

Slide 35 text

Objective-C Java @interface (.h) & @implementation (.m) class (1 file) @protocol interface #import // files! import // classes! categories n/a (C#, “class extensions”) id n/a (generics?) "void*"

Slide 36

Slide 36 text

Objective-C Java / C# @selector n/a (C# delegates) NSObject / NSProxy / ... Object @public / @protected / @private public / protected / private @try / @catch / @finally NSException try / catch / finally Exception n/a package / namespace

Slide 37

Slide 37 text

Classes

Slide 38

Slide 38 text

extends class

Slide 39

Slide 39 text

Methods

Slide 40

Slide 40 text

Syntax inspired from Smalltalk

Slide 41

Slide 41 text

void insertObject(anObject, index)

Slide 42

Slide 42 text

aName.copy() this.alloc().initWithString(aName).autorelease()

Slide 43

Slide 43 text

Memory Management

Slide 44

Slide 44 text

iPhone 3G: 128 MB RAM iPhone 3GS, iPad: 256 MB RAM iPhone 4: 512 MB RAM

Slide 45

Slide 45 text

±70 MB for the OS!

Slide 46

Slide 46 text

no swap file

Slide 47

Slide 47 text

(no virtual memory)

Slide 48

Slide 48 text

http://www.flickr.com/photos/cheek/699407283/

Slide 49

Slide 49 text

no garbage collection

Slide 50

Slide 50 text

objects have a “retain count”

Slide 51

Slide 51 text

http://cocoadevcentral.com/d/learn_objectivec/

Slide 52

Slide 52 text

basic rule:

Slide 53

Slide 53 text

for every [alloc], [retain], [copy] there must be a [release]

Slide 54

Slide 54 text

beware:

Slide 55

Slide 55 text

Objective-C only allows objects on the heap

Slide 56

Slide 56 text

http://linguiniontheceiling.blogspot.com/2008/10/thats-madame-trash-heap-to-you.html

Slide 57

Slide 57 text

No automatic objects on the stack (C++)

Slide 58

Slide 58 text

http://www.futuregov.net/photologue/photo/2008/aug/30/stack-papers/

Slide 59

Slide 59 text

// C++ // Memory freed when out of scope std::string name(“Adrian”); std::string *name = NULL; name = new std::string(“Adrian”); delete name;

Slide 60

Slide 60 text

iOS memory warnings

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

http://www.flickr.com/photos/tbuser/2763035540/

Slide 63

Slide 63 text

http://akosma.com/2009/01/28/10-iphone-memory-management-tips/

Slide 64

Slide 64 text

http://akosma.com/2009/07/16/objective-c-compiler-warnings/

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

Cocoa

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

UIKit

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

Tools

Slide 72

Slide 72 text

Xcode Interface Builder

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

Shark

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

Instruments

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

No content

Slide 81

Slide 81 text

No content

Slide 82

Slide 82 text

Clang Static Analyzer

Slide 83

Slide 83 text

http://llvm.org/

Slide 84

Slide 84 text

http://clang-analyzer.llvm.org/

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

Source: Apple Documentation

Slide 87

Slide 87 text

Source: Apple Documentation

Slide 88

Slide 88 text

Source: Apple Documentation

Slide 89

Slide 89 text

Source: Apple Documentation

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

Web or native apps?

Slide 92

Slide 92 text

update frequency usage frequency UI complexity native apps web apps stocks calculator business forms reports

Slide 93

Slide 93 text

Web Application Native SDK Application Pros Simpler deployment and updates; known technologies, cheaper to maintain; access to GPS information; basic offline support. Faster execution; access to address book, accelerometer, audio and camera; 3D games and animations; push notifications; Bonjour networking support. Cons Slower to execute; no access to hardware. App Store review process; longer update times.

Slide 94

Slide 94 text

Sencha Touch iUI jQTouch WebApp.net XUI Rhodes SproutCore Cappuccino LiquidGear PhoneGap Safire jPint Magic Framework

Slide 95

Slide 95 text

Also remember

Slide 96

Slide 96 text

Not all WebKits are made equal

Slide 97

Slide 97 text

WebKit Compatibility Table http://www.quirksmode.org/webkit.html

Slide 98

Slide 98 text

No content

Slide 99

Slide 99 text

Native apps advantages

Slide 100

Slide 100 text

1 offline web catching up!

Slide 101

Slide 101 text

2 location services web catching up!

Slide 102

Slide 102 text

3 camera

Slide 103

Slide 103 text

4 audio & 3D

Slide 104

Slide 104 text

5 accelerometer & gyroscope web catching up!

Slide 105

Slide 105 text

6 notifications

Slide 106

Slide 106 text

http://www.flickr.com/photos/epitti/2565572445/

Slide 107

Slide 107 text

7 monetization!

Slide 108

Slide 108 text

Native components

Slide 109

Slide 109 text

Address Book ABAddressBook ABMultiValue ABMutableMultiValue ABRecord ABGroup ABPerson http://www.flickr.com/photos/kevinmarsh/2315151843/

Slide 110

Slide 110 text

Accelerometer UIAccelerometer UIAccelerometerDelegate http://www.flickr.com/photos/evert-jan/2784525711/ http://www.flickr.com/photos/evert-jan/2785380754/

Slide 111

Slide 111 text

Video MPMoviePlayerController http://www.flickr.com/photos/pingping/1431127181/

Slide 112

Slide 112 text

Location services CLLocation CLLocationManager http://www.flickr.com/photos/thomcochrane/2780365916/

Slide 113

Slide 113 text

Graphics & Animation CALayer CAAnimation UIGraphicsContext CGRect / CGMakeRect UIBezierPath UIColor http://www.flickr.com/photos/alleus/2905293514/

Slide 114

Slide 114 text

Camera & Photo Library UIImagePickerController UIImagePickerControllerDelegate UIImagePickerControllerSourceTypeCamera UIImagePickerControllerSourceTypePhotoLibrary http://www.flickr.com/photos/ernohannink/2713579416/

Slide 115

Slide 115 text

And More Audio XML WebKit SQLite / Core Data Networking Bonjour Bluetooth / GameKit AirPrint iCal (EventKit) AirPlay Compass Gyroscope Gestures Core Text

Slide 116

Slide 116 text

No content

Slide 117

Slide 117 text

Other languages? Cross-platform?

Slide 118

Slide 118 text

http://akosma.com/2009/10/29/iphone-apps-without-objective-c/

Slide 119

Slide 119 text

No content

Slide 120

Slide 120 text

The App Store in 5 steps

Slide 121

Slide 121 text

1. Register

Slide 122

Slide 122 text

http://developer.apple.com/programs/iphone/

Slide 123

Slide 123 text

2. Develop

Slide 124

Slide 124 text

No content

Slide 125

Slide 125 text

3. Publish

Slide 126

Slide 126 text

No content

Slide 127

Slide 127 text

Requirements Free apps: nothing Paying apps: EIN Number, via IRS Bank account

Slide 128

Slide 128 text

4. Approval

Slide 129

Slide 129 text

No content

Slide 130

Slide 130 text

4.1 Rejection

Slide 131

Slide 131 text

“Your application cannot be posted to the App Store at this time because it does not adhere to the iPhone Human Interface Guidelines as outlined in iPhone SDK Agreement section x.x.x. When the device is in this or that condition, the application does not do this or that. This behavior might lead to user confusion. It would be appropriate to display either a notification or an alert stating that such or such condition is required. In order for your application to be reconsidered for the App Store, please resolve this issue and upload your new binary to iTunes Connect.”

Slide 132

Slide 132 text

5. Sales

Slide 133

Slide 133 text

https://itunesconnect.apple.com/

Slide 134

Slide 134 text

No content

Slide 135

Slide 135 text

No content

Slide 136

Slide 136 text

Honor the Mobile Human Interface Guidelines

Slide 137

Slide 137 text

http://developer.apple.com/iphone/library/documentation/ userexperience/conceptual/mobilehig/

Slide 138

Slide 138 text

No content

Slide 139

Slide 139 text

avoid this

Slide 140

Slide 140 text

http://www.flickr.com/photos/gruber/2635257578/

Slide 141

Slide 141 text

and this

Slide 142

Slide 142 text

http://smokingapples.com/iphone/app-store-iphone/the-worst-twitter-client-ever/

Slide 143

Slide 143 text

“ I can’t find one redeeming quality about this app. It’s slow to start [on a 3GS], doesn’t respond to taps while it’s trying to load other things, and crashes if you try to change modes a lot. It’s limited to only timeline, replies, and messages. It has no other functionality. Oh wait… I forgot its killer feature, you can have custom backgrounds and choose the color of your tweets. That totally makes up for its lack of useful features and sluggish performance. I’m not sure why someone would bother building such an inferior app other than that they wanted to find some suckers and score a quick buck. It seems even more insane to me that they’d be actively seeking out reviewers to cover this. I was given a promo code for ChillTwit, and even for free I didn’t want it on my phone. I was sad just from looking at screenshots. Actually seeing it running confirmed all of my fears. If it was a free app, I might forgive the developer, but the fact that he’s trying to get $0.99 out of people pisses me off to no end. Go buy Tweetie. If you somehow weren’t scared away by all my bitching and whinning, you can see ChillTwit on the app store here. But seriously, if you buy this, we’re not friends anymore.

Slide 144

Slide 144 text

No content

Slide 145

Slide 145 text

Books

Slide 146

Slide 146 text

No content

Slide 147

Slide 147 text

No content

Slide 148

Slide 148 text

No content

Slide 149

Slide 149 text

No content

Slide 150

Slide 150 text

No content

Slide 151

Slide 151 text

No content

Slide 152

Slide 152 text

No content

Slide 153

Slide 153 text

No content

Slide 154

Slide 154 text

No content

Slide 155

Slide 155 text

No content

Slide 156

Slide 156 text

No content

Slide 157

Slide 157 text

No content

Slide 158

Slide 158 text

No content

Slide 159

Slide 159 text

Thanks!

Slide 160

Slide 160 text

Questions?

Slide 161

Slide 161 text

Created and edited on Keynote for iPad Copyright 2011 (c) akosma software All Rights Reserved.