Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Ways to build REST mobile client
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Oursky Limited
June 27, 2013
Programming
180
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ways to build REST mobile client
Oursky Limited
June 27, 2013
More Decks by Oursky Limited
See All by Oursky Limited
UI Automation
oursky
1
570
SSH Can
oursky
1
350
HTTP/2
oursky
0
390
watchOS2
oursky
0
380
Common QA issues
oursky
0
250
Complex is better than complicated
oursky
0
320
Clean code again
oursky
3
420
KiriKiri x O2 x NVLMarker
oursky
0
280
Flux + React
oursky
1
420
Other Decks in Programming
See All in Programming
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
1
280
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
170
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
120
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
440
新卒PdEのリアル
ryu1013
1
500
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
720
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
160
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
3
550
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2k
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
360
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
210
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
0
1.5k
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Everyday Curiosity
cassininazir
0
320
How to Think Like a Performance Engineer
csswizardry
28
2.8k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
510
We Are The Robots
honzajavorek
0
380
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Navigating Weather and Climate Data
rabernat
0
520
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
320
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
550
Raft: Consensus for Rubyists
vanstee
142
7.7k
Transcript
Ways to build REST mobile client Edwin Kwok Thursday, 27
June, 13
iOS Thursday, 27 June, 13
Network Manager Network Connection Builder / Factory Network Manager Delegate
Rugby Implementation Thursday, 27 June, 13
NetworkManager NetworkConnection NewsBuilder NewsViewController<NetworkManagerDelegate> Rugby Implementation 1. ask for News
6. News 2. send request 3. response 4. parse response 5. News Thursday, 27 June, 13
WeSnap Implementation ????? Thursday, 27 June, 13
RestKit Challenges Offline Data Access Flaky Connectivity Different Data Formats
Thursday, 27 June, 13
RestKit Features Integrated HTTP Stack Pluggable Parser Object Mapping Core
Data Integration UI Integration Thursday, 27 June, 13
Integrated HTTP Stack Base URLs Custom Header Network Indicator Performing
Requests Background Processing Authentication Request caching Thursday, 27 June, 13
Integrated HTTP Stack / / create client RKClient *client =
[RKClient clientWithBaseURL:@”http:/ /github.org”]; / / set header [client setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forHTTPHeaderField:@”X-UDID”]; / / set indicator behavior client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; Thursday, 27 June, 13
Performing Request - (IBAction)forkYouWithBlocks { self.imageView.image = nil; [[RKClient sharedClient]
get:@"http:/ /github.com/fluidicon.png" usingBlock:^(RKRequest *request) { [request setBackgroundPolicy:RKRequestBackgroundPolicyContinue]; [request setOnDidLoadResponse:^(RKResponse *response) { if (response.isSuccessful) { UIImage *image = [UIImage imageWithData:response.body]; self.imageView.image = image; } }]; }]; } Thursday, 27 June, 13
Background Processing [request setBackgroundPolicy:RKRequestBackgroundPolicyContinue]; RKRequestBackgroundPolicyNone / / do nothing RKRequestBackgroundPolicyCancel
/ / cancel request RKRequestBackgroundPolicyContinue / / continue RKRequestBackgroundPolicyRequeue / / requeue upon app restart Thursday, 27 June, 13
Object Mapping Simple Object Mapping Mapping Relationships Inverse Mappings Serialization
Mappings Thursday, 27 June, 13
Object mapping { id: 1, name: “Peter”, location: “Hong Kong”,
followers: 1, email: “
[email protected]
”, following: 36 } @interface User : NSObject @property (strong, nonatomic) NSNumber *id; @property (strong, nonatomic) NSString *name; @property (strong, nonatomic) NSString *location; @property (strong, nonatomic) NSNumber *followers; @property (strong, nonatomic) NSString *email; @property (strong, nonatomic) NSNumber *following; @end Thursday, 27 June, 13
Object mapping / / register mapping for a class objectMapping
= [RKObjectMapping mappingForClass:[User class]]; [objectMapping mapKeyPath:@"id" toAttribute:@"id"]; [objectMapping mapKeyPath:@"name" toAttribute:@"name"]; [objectMapping mapKeyPath:@"location" toAttribute:@"location"]; [objectMapping mapKeyPath:@"email" toAttribute:@"email"]; [objectMapping mapKeyPath:@"following" toAttribute:@"following"]; [objectMapping mapKeyPath:@"followers" toAttribute:@"followers"]; Thursday, 27 June, 13
Object mapping [[RKObjectManager sharedManager] loadObjectsAtResourcePath:[NSString stringWithFormat:@"/users/%@", userName] usingBlock:^(RKObjectLoader *loader) {
[SVProgressHUD showWithStatus:@"Loading..."]; [loader setObjectMapping:objectMapping]; [loader setOnDidLoadObject:^(id object) { [SVProgressHUD dismiss]; }]; [loader setOnDidFailWithError:^(NSError *error) { [SVProgressHUD showErrorWithStatus:@"Problem loading user"]; }]; }]; Thursday, 27 June, 13
Mapping Relationship RKObjectMapping *userMapping = [RKObjectMapping mappingForClass:[User class]]; RKObjectMapping *issueMapping
= [RKObjectMapping mappingForClass:[Issue class]]; / / create relationships [issueMapping mapKeyPath:@"user" toRelationship:@"user" withMapping:userMapping]; { number: 1, title: “Issue #1”, user: { ... } } @interface Issue : NSObject @property (strong, nonatomic) NSNumber *number; @property (strong, nonatomic) NSString *title; @property (strong, nonatomic) User *user; @end Thursday, 27 June, 13
Android Thursday, 27 June, 13
Thursday, 27 June, 13
Problem The operating system may shut down the process Solution:
use service Thursday, 27 June, 13
Use a Service API Thursday, 27 June, 13
Use ContentProvider API Thursday, 27 June, 13
Google I/0 2013 Volley: Easy, Fast Networking for Android Thursday,
27 June, 13
Why Volley Restful apps have common features: infinite scroll image
loading offline caching request priority Volley provides all of them Thursday, 27 June, 13
Reference http:/ /www.amazon.com/Test-Driven-iOS- Development-Developers-Library/dp/ 0321774183 http:/ /restkit.org/ https:/ /dl.google.com/googleio/2010/android- developing-RESTful-android-apps.pdf
http:/ /www.youtube.com/watch? v=yhv8l9F44qo Thursday, 27 June, 13