Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to iOS Software Development

Introduction to iOS Software Development

Presentation given during OOP 2011, Münich, Germany.


Adrian Kosmaczewski

January 26, 2011


  1. Introduction to iOS Software Development Adrian Kosmaczewski - akosma software

    OOP 2011
  2. Adrian Kosmaczewski

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

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

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

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

  7. akosma software

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

  9. None
  10. None
  11. None
  12. iOS

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

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

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

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

  17. None
  18. Some questions

  19. iOS devices in the room?

  20. Veteran NeXT or Mac OS X developers in the room?

  21. None
  22. Program History Objective-C Cocoa Tools Web vs. Native Apps The

    App Store Design Books Q&A
  23. None
  24. History

  25. “Good design survives” Erich Gamma OOP 2011 Keynote

  26. born in the 80s

  27. None
  28. None
  29. None
  30. None
  31. None
  32. Objective-C

  33. "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
  34. 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
  35. 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*"
  36. 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
  37. Classes

  38. extends class

  39. Methods

  40. Syntax inspired from Smalltalk

  41. void insertObject(anObject, index)

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

  43. Memory Management

  44. iPhone 3G: 128 MB RAM iPhone 3GS, iPad: 256 MB

    RAM iPhone 4: 512 MB RAM
  45. ±70 MB for the OS!

  46. no swap file

  47. (no virtual memory)

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

  49. no garbage collection

  50. objects have a “retain count”

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

  52. basic rule:

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

  54. beware:

  55. Objective-C only allows objects on the heap

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

  57. No automatic objects on the stack (C++)

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

  59. // C++ // Memory freed when out of scope std::string

    name(“Adrian”); std::string *name = NULL; name = new std::string(“Adrian”); delete name;
  60. iOS memory warnings

  61. None
  62. http://www.flickr.com/photos/tbuser/2763035540/

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

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

  65. None
  66. Cocoa

  67. None
  68. UIKit

  69. None
  70. None
  71. Tools

  72. Xcode Interface Builder

  73. None
  74. Shark

  75. None
  76. None
  77. None
  78. Instruments

  79. None
  80. None
  81. None
  82. Clang Static Analyzer

  83. http://llvm.org/

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

  85. None
  86. Source: Apple Documentation

  87. Source: Apple Documentation

  88. Source: Apple Documentation

  89. Source: Apple Documentation

  90. None
  91. Web or native apps?

  92. update frequency usage frequency UI complexity native apps web apps

    stocks calculator business forms reports
  93. 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.
  94. Sencha Touch iUI jQTouch WebApp.net XUI Rhodes SproutCore Cappuccino LiquidGear

    PhoneGap Safire jPint Magic Framework
  95. Also remember

  96. Not all WebKits are made equal

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

  98. None
  99. Native apps advantages

  100. 1 offline web catching up!

  101. 2 location services web catching up!

  102. 3 camera

  103. 4 audio & 3D

  104. 5 accelerometer & gyroscope web catching up!

  105. 6 notifications

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

  107. 7 monetization!

  108. Native components

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

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

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

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

  113. Graphics & Animation CALayer CAAnimation UIGraphicsContext CGRect / CGMakeRect UIBezierPath

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

  115. And More Audio XML WebKit SQLite / Core Data Networking

    Bonjour Bluetooth / GameKit AirPrint iCal (EventKit) AirPlay Compass Gyroscope Gestures Core Text
  116. None
  117. Other languages? Cross-platform?

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

  119. None
  120. The App Store in 5 steps

  121. 1. Register

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

  123. 2. Develop

  124. None
  125. 3. Publish

  126. None
  127. Requirements Free apps: nothing Paying apps: EIN Number, via IRS

    Bank account
  128. 4. Approval

  129. None
  130. 4.1 Rejection

  131. “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.”
  132. 5. Sales

  133. https://itunesconnect.apple.com/

  134. None
  135. None
  136. Honor the Mobile Human Interface Guidelines

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

  138. None
  139. avoid this

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

  141. and this

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

  143. “ 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.
  144. None
  145. Books

  146. None
  147. None
  148. None
  149. None
  150. None
  151. None
  152. None
  153. None
  154. None
  155. None
  156. None
  157. None
  158. None
  159. Thanks!

  160. Questions?

  161. Created and edited on Keynote for iPad Copyright 2011 (c)

    akosma software All Rights Reserved.