Native iPhone Development 101
Sasmito Adibowo
adib (at) basil-salad dot com
http://www.basil-salad.com
3-Nov-2009
Agenda

Getting Started
What’s available to you
Accessing Web Services
Apple’s App Store
Beyond the App Store
Hello World ...
What do you need
Minimum               Good to have
 An Intel Mac with     An iPhone or iPod
 Leopard or Snow       touch
...
The iPhone Stack


     Cocoa Touch                       WebKit

   Objective-C Runtime           Core*** Frameworks

 AN...
Network Environment
Programming Languages
Objective-C
  Superset of C
  Dynamic Binding
  Cocoa Touch
C/C++
JavaScript
Class Declaration

#import <Foundation/Foundation.h>

@interface ThisIsAClass : NSObject {
@public
! // public data variab...
Class Implementation

#import "ThisIsAClass.h"

@implementation ThisIsAClass

-(void) doSomeThingAt:(id) whatever optionsA...
What you can do
Floating-point math          Network (TCP/IP) in & out
Threads                      Accelerated 3D graphic...
What you can’t do
Run in the background     Intercept phone calls /
                          SMSs / e-mails
Forking / mul...
Cocoa Touch

MVC design pattern
Non-overlapping
window
Buttons, etc
Web Browser
Map Browser
Accessing Web Services

Built-in support
  JSON
  Property List Talk
3rd party
  SOAP
  RemObjects
JavaScript Object Notation (JSON)

                          {
                                  "firstName": "John",
 Lis...
JSON Example
 Your iApp             UIWebView         Your Server

             HTTP Request

                            ...
Property List Talk
                                       <?xml version="1.0" encoding="UTF-8"?>
                         ...
HTTP-Plist Example
Your iApp                NSDictionary                  Your Server

      [NSDictionary dictionaryWithC...
Case Study: Fund Watch
  Display fund prices from
  Fundsupermart*
  Screen scraper
  JavaScript-based HTML
  parser
  Der...
Fund Watch Parser
Fund Watch               UIWebView          fundsupermart.com

    Load JavaScript library

            ...
The App Store
Accessible via iTunes
  3rd party screen
  scrapers
The only way to sell your
native apps
50K+ apps and coun...
Selling your Apps
1. Register for an iPhone Developer account

2. Get your bank’s SWIFT code

3. Prepare IRS documents

  ...
Beyond the App Store

    Advertisement    Admob

         Analytics   Pinch Media

 Social Networking   OpenFeint
AdMob
Pinch Analytics
OpenFeint
Hello, World!
The End
http://basil-salad.com
Upcoming SlideShare
Loading in...5
×

Native Phone Development 101

2,653

Published on

The basics of programming native applications on the iPhone and iPod touch. Delivered as a session in Singapore PHP User Group meeting 3-Nov-2009.

Event URL: http://bit.ly/phpsgnov09

Published in: Technology, News & Politics
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,653
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
14
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "Native Phone Development 101"

  1. 1. Native iPhone Development 101 Sasmito Adibowo adib (at) basil-salad dot com http://www.basil-salad.com 3-Nov-2009
  2. 2. Agenda Getting Started What’s available to you Accessing Web Services Apple’s App Store Beyond the App Store Hello World Demo
  3. 3. What do you need Minimum Good to have An Intel Mac with An iPhone or iPod Leopard or Snow touch Leopard iPhone Developer iPhone SDK (free membership download) A bank account Some free time and (SWIFT) patience
  4. 4. The iPhone Stack Cocoa Touch WebKit Objective-C Runtime Core*** Frameworks ANSI C Runtime ANSI C++ Runtime OpenGL ES Unix (BSD Variant), 32-bit ARM
  5. 5. Network Environment
  6. 6. Programming Languages Objective-C Superset of C Dynamic Binding Cocoa Touch C/C++ JavaScript
  7. 7. Class Declaration #import <Foundation/Foundation.h> @interface ThisIsAClass : NSObject { @public ! // public data variables @protected ! // protected data variables @private ! // private data variables ! } // a message handler -(void) doSomeThingAt:(id) whatever optionsAre:(NSDictionary*) options; @end
  8. 8. Class Implementation #import "ThisIsAClass.h" @implementation ThisIsAClass -(void) doSomeThingAt:(id) whatever optionsAre:(NSDictionary*) options { ! if ([whatever respondsToSelector:@selector(sayHello:)]) { ! ! [whatever sayHello:options]; ! } } @end
  9. 9. What you can do Floating-point math Network (TCP/IP) in & out Threads Accelerated 3D graphics C++ Programming Memory-mapped files — BSD mmap() STL included Control iPod playback Access the Address Book (new in OS 3.0) Compose e-mail Write to the Photo Library
  10. 10. What you can’t do Run in the background Intercept phone calls / SMSs / e-mails Forking / multitasking Create self-modifying Access the Calendar code Read user’s e-mail Access other application’s data area
  11. 11. Cocoa Touch MVC design pattern Non-overlapping window Buttons, etc Web Browser Map Browser
  12. 12. Accessing Web Services Built-in support JSON Property List Talk 3rd party SOAP RemObjects
  13. 13. JavaScript Object Notation (JSON) { "firstName": "John", List of Values in "lastName": "Smith", "address": { JavaScript syntax "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", Useful if you have a "postalCode": "10021" }, JavaScript interpreter "phoneNumbers": [ ready { "type": "home", "number": "212 555-1234" }, { "type": "fax", iPhone has one! ] "number": "646 555-4567" } }
  14. 14. JSON Example Your iApp UIWebView Your Server HTTP Request JSON Response JSON String Data Values
  15. 15. Property List Talk <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" Apple’s first-class XML ! "http://www.apple.com/DTDs/ PropertyList-1.0.dtd"> format <plist version="1.0"> <dict> <key>Year Of Birth</key> <integer>1965</integer> Can be easily <key>Pets Names</key> <array/> generated by a PHP <key>Picture</key> <data> script ! PEKBpYGlmYFCPA== </data> <key>City of Birth</key> <string>Springfield</string> Built-in conversion to <key>Name</key> <string>John Doe</string> Cocoa objects <key>Kids Names</key> <array> ! <string>John</string> NSDictionary* dic = [NSDictionary ! <string>Kyra</string> dictionaryWithContentsOfURL:...]; </array> </dict> </plist>
  16. 16. HTTP-Plist Example Your iApp NSDictionary Your Server [NSDictionary dictionaryWithContentsOfURL:...] HTTP Request Property List response new Dictionary object
  17. 17. Case Study: Fund Watch Display fund prices from Fundsupermart* Screen scraper JavaScript-based HTML parser Derived from Fundsupermart Dashboard Widget *Fund Watch is not associated with Fundsupermart
  18. 18. Fund Watch Parser Fund Watch UIWebView fundsupermart.com Load JavaScript library Request fund prices page HTML Page Parse HTML Page Fund prices
  19. 19. The App Store Accessible via iTunes 3rd party screen scrapers The only way to sell your native apps 50K+ apps and counting Requires a developer’s account
  20. 20. Selling your Apps 1. Register for an iPhone Developer account 2. Get your bank’s SWIFT code 3. Prepare IRS documents 1. Fill and submit SS-4 “Request for EIN” to IRS 2. Wait for your EIN from IRS 3. Fill form W8-BEN and submit to Apple 4. Fill the Paid Applications Contract 5. Register SWIFT code to Apple 6. Upload your paid applications to Apple’s iTunes Connect
  21. 21. Beyond the App Store Advertisement Admob Analytics Pinch Media Social Networking OpenFeint
  22. 22. AdMob
  23. 23. Pinch Analytics
  24. 24. OpenFeint
  25. 25. Hello, World!
  26. 26. The End http://basil-salad.com

×