3. • It’s awesome: iPhone, iPad, iPod Touch
• Best Mobile App Dev Platform (by light years)
• Objective-C + Foundation + Cocoa
• Lots of potential users
• lots of potentially paying users
Why iOS
4. • Software architecture for distributed systems
• say web services/APIs
• Client-Server
• Works over HTTP & URI-based
• http://api.twitter.com/1/statuses/public_timeline.json
REST Quick Intro
5. • There’s always something you need in “the cloud”
• Data or processing power
• More true on mobile
• Universal: mobile, desktop, web clients
• It’s easy to implement server side ( at least the basic stuff)
• and everyone is doing it (twitter, github, amazon, google, ...)
• It’s easy to implement on the client
Why REST
7. iOS REST Recipe
Function Library I Use Currently iOS Boilerplate
HTTP Requests ASIHTTPRequest AFNetworking
JSON
SBJson
(AKA json-framework)
JSONkit
Image Caching
AFNetworking
(I previously used HJCache)
AFNetworking
Pull-To-Refresh
PullToRefreshTableViewController
by Leah Culver
EGOTableViewPullToRefresh
HUD
SVProgessHUD
(I previously used DSActivityView)
SVProgessHUD
8. • Am I connected to the internet?
• Wifi or Cellular?
Reachability
(SystemConfiguration framework)
12. •The app continues to execute
•UI continues to be responsive
•The request runs in the background
•Two (common) ways of doing it in iOS:
•Delegate
•Block
Asynchronous Requests
13. • The delegator object has a delegate property that
points to the delegate object
• A delegate acts when its delegator encounters a
certain event
• The delegate adopts a protocol
• We’ll need 2 methods: success & failure
Cocoa Delegate Pattern
15. Cocoa Blocks
• Ad hoc function body as an expression
• Carry their code & the data they need
• ideal for callbacks
• We’ll need 2 blocks: success & failure
19. Where to Load Data
• viewDidLoad / viewWillAppear
• Make the asynchronous request
• Show HUD or other “loading” indicators
• LOADED = NO;
• Delegate
• LOADED = YES;
• Reload table
• Partial Load + Pagination
• Load more at the end of the table
31. INCEPTION
[{[{}]}]
An array of
objects with an
array of objects
[
{
"name":
"object1",
"sub":
[
{
"name":
"subobject1"
},
{
"name":
"subobject2"
}
]
},
]
or rather JCEPTION