Hdc09 I Phone Dev Connecting To Web - Presentation Transcript
iPhone Development
Connecting to the cloud
Ninth Division
real legit growing apple platforms development
company in omaha, ne
www.ninthdivision.com
@ninthdivision
Andy Peters
@andypeters
Midwest Mobile
Developers
connecting all the mobile developers in the region
(Nebraska, Iowa, Kansas, Missouri)
http://groups.google.com/group/midwest-mobile-developers
Getting started with
iPhone Development
Getting started with
iPhone Development
flickr: kmulcahy
flickr: kmulcahy
iPhone The Cloud
Why?
flickr: Waldo#4
30 Million
iPhone’s Sold as of Sept. 2009
20 Million
iPod Touches Sold as of Sept. 2009
User experience.
Offline usage.
Unreliable Connectivity.
Social networks.
More devices...
More devices...
More devices...
More devices...
iPhone users use the
hell out of social apps
15,604,157 Monthly Active Users
Facebook for the iPhone
Tweetie 2 for the iPhone
Be unique.
flickr: Erica Marshall
Game’s submitting
scores to community.
Post high score to
twitter.
Announce new user
profile on Facebook.
Music related app uses
Last.fm for data.
Grab data to populate a
map.
Some devices are tied
directly to the cloud.
MORE and MORE!
Connection Methods.
flickr: barjack
Web Services
~=
The Cloud
XML
RESTful please!
XML
There is no SOAP Client #642 or XML-RPC Client
#1,203. You parse it yourself.
Options for Parsing
XML
• libxml2
• Tree-based: easy to parse, tree in memory
• Event-driven: less memory, more complex managing state
• Text reader: fast, easy to write
• NSXMLParser
• Event-driven: simpler but less powerful than libXML
• No NSXMLDocument on iPhone
• expat too!!!
XML Code
NSXMLParser *parser = [[NSXMLParser alloc]initWithData:....];
XML Code
NSXMLParser *parser = [[NSXMLParser alloc]initWithData:....];
XML [delegate] Code
XML [delegate] Code
XML Docs.
• “Event Driven XML Programming in
Cocoa” - ADC
• NSXMLParser.h / Supporting doc.
• NSXMLParserDelegate.h / Supporting doc.
• Sample code: XMLPerformance and
SeismicXML
• Google: cocoa + nsxmlparser
JSON
JavaScript Object Notation
JavaScript Object
Notation
• More lightweight than XML
• Similar to a Property List
• arrays, dictionaries, strings, numbers
• Open Source json-framework wrapper for
Objective-C
• no “official” Apple library (yet)
JavaScript Object
Notation
• If I have a choice, I prefer using JSON
• Lightweight
• Fast
• Easy to parse and map to objects.
Parsing JSON
#import <JSON/JSON.h>
// Get a JSON string
NSString *jsonString = ....;
// Parsing will result in Foundation objects
id object = [jsonString JSONValue];
Using JSON-framework
// Create data.
NSDictionary *dictionary = ...;
// converts into a JSON spring.
jsonString = [dictionary JSONRepresentation];
UIWebView
Best Practices
Asynchronous
Never parse on the main thread.
NSOperation
Never assume you
know the size of the
server response.
Delegates methods
Show progress.
Debugging.
Caching
Libraries, Frameworks
and Wrappers
flickr: (Erik)
MGTwitterEngine
ObjectiveFlickr
Facebook Connect
iPhone on Rails
ASIHTTPRequest
Development Demos
flickr: TheNixer
Development Demos
flickr: TheNixer
Questions ?
flickr: Jim in Times Square
ninth Division
real legit growing apple platforms development
company in omaha, ne
www.ninthdivision.com
@ninthdivision
0 comments
Post a comment