A perspective on iPhone development from a server-side developer with very little GUI background.
Given at http://www.lfpug.com in London on 26 March 2009.
10. “People must have assumed that
all I had to do was plug Facebook's
data into Apple's ready-to-use UI
components and hit the GO
button.
Joe Hewitt on the
native Facebook app
11. “I wish it had been that easy, but
unfortunately many of the
components I needed were missing
from the iPhone SDK, even though
they existed in Apple's own apps.”
Joe Hewitt on the
native Facebook app
19. HTTP
NSURLRequest is fiddly.
I use GTMHTTPFetcher from
Google Toolbox for Mac.
http://code.google.com/p/google-toolbox-for-mac/
or TTURLRequest from Joe Hewitt
http://joehewitt.com/post/the-three20-project/
20. XML
Mac OS X has NSXMLDocument
for DOM parsing.
The iPhone only has NSXML for
SAX parsing. This is hard.
21. XML
iPhone ships with libxml2. It is
good, fast and has a nasty C API.
Convenience wrapper functions
make it much easier:
NSArray *PerformXMLXPathQuery(NSData *document,
NSString *query);
http://cocoawithlove.com/2008/10/using-libxml2-for-parsing-and-xpath.html
22. JSON
Objective C coders make liberal
use of mix-ins. Ruby coders fondly
call this ‘monkeypatching’.
#import quot;NSString+SBJSON.hquot;
[@quot;{quot;1quot;:2}quot; JSONValue];
(returns an NSDictionary)
23. Regular Expressions
Some people, when confronted
with a problem, think “I know, I'll
use regular expressions.”
Now they have two problems.
—usually attributed to jwz in comp.lang.emacs
24. Regular Expressions
Again, the iPhone’s string handling
has no regular expression builtins.
But it ships with the ICU library
that does.
25. Regular Expressions
RegexKitLite extends NSString
with methods that bridge to ICU.
This gives you UTF-safe functions
with small memory overhead and
caching.
http://regexkit.sourceforge.net/RegexKitLite/
26. Regular Expressions
As usual with Objective C, the
method names are rather verbose.
split: componentsSeparatedByRegex
gsub: stringByReplacingOccurrencesOfRegex
backrefs: matchEnumeratorWithRegex
27. Local Storage
SQLite is the iPhone’s default
database management library.
This is a good thing.
29. Local Storage
FMDB is an Objective C wrapper
modeled on Java’s JDBC. It’s
sensible.
FMDatabase* db = [FMDatabase databaseWithPath:@quot;...quot;];
[db open];
[db executeUpdate:@”SELECT ...”];
http://code.google.com/p/flycode/source/browse/trunk/fmdb