SlideShare a Scribd company logo
or the Weary
No RestKit f
Matt Galloway
Architactile
matt@architactile.com
918-808-3072

Tuesday, January 28, 14
Some
Amazingly
Cool Data
from the
“Cloud”

ul* Web
RESTF es
Servic

the “Cloud”

REST-ish and JSONy.
ul,“ of course, I mean
* By “RESTF
Tuesday, January 28, 14
rvice Calls on iOS
Web Se
Define your URL
NSString *url = @”http://somewebservice.com/objects.json”;

Make the Call
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];

ese delegate methods!!!
Then implement all of th
-

(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
(void)connectionDidFinishLoading:(NSURLConnection *)connection

and now you have to parse
the JSON in NSData
into something useful...
Tuesday, January 28, 14
n is great, but...
NSJSONSerializatio
-(void) parseJSONIntoModel:(NSData *) jsonData {
NSError *error = nil;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonData
options:NSJSONReadingAllowFragments
error:&error];
if (error!=nil) {
// TODO: Insert annoying JSON error handler here.
}
if ([json isKindOfClass:[NSArray class]]) {
//TODO: Uh. I was expecting a dictionary but apparently this is an array. Writng some handling code here.
}
for(NSString *key in [json allKeys]) {
if ([key isEqualToString:@"user"]) {
NSDictionary *userDictionary = [json objectForKey:key];
NSNumber *userId = [userDictionary objectForKey:@"id"];
RKGUser *user = [[ObjectFactory sharedFactory] userForUserId:userId];
if (user==nil) {
user = [[ObjectFactory sharedFactory] newUser];
user.userId=useriD;
}

}
.
.
.

user.name = [userDictionary objectForKey:@"name"];
user.username = [userDictionary objectForKey:@"username"];
user.phone = [userDictionary objectForKey:@"phone"];
user.email = [userDictionary objectForKey:@"email"];

Tuesday, January 28, 14
nter RestKit
E
https://github.com/RestK
it

/RestKit/

ing and modeling
ework for consum
RestKit is a fram
s on iOS and OS X
Tful web resource
RES

Tuesday, January 28, 14
[[RKObjectManager sharedManager] getObjectsAtPath:@"objects.json"
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
// Call is successful. Objects are all populated.
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
// Call failed.
}];

Tuesday, January 28, 14
RestKit is...
rce & available on GitHub
* Open Sou
* Built on AFNetworking
Beautifully multi-threaded
*
eamlessly with CoreData
* Integrates s
o works with plain objects
* Als
lationships, nesting, etc.
* Handles re
on mapping like an ORM
* Based
* Very configurable
, POST, PATCH, etc.
ndles all REST verbs - GET
* Ha
y actively maintained
* Ver
ase seeding, search,
ch of other stuff - datab
* A bu n
XML, etc.
Tuesday, January 28, 14
ing RestKit
Install
I <3 CocoaPods
$ cd /path/to/MyProject
$ touch Podfile
$ edit Podfile
platform :ios, '5.0'
# Or platform :osx, '10.7'
pod 'RestKit', '~> 0.20.0'
$ pod install
$ open MyProject.xcworkspace

Tuesday, January 28, 14
Using RestKit: The W
e

Tuesday, January 28, 14

b Service
Using RestKit: The Object
@interface Joke : NSObject
@property (nonatomic, strong) NSNumber *jokeId;
@property (nonatomic, strong) NSString *text;
@end
@implementation Joke
@end

Tuesday, January 28, 14
Using RestKit: The Setup
-(void) setupRestKit {
RKObjectManager *objectManager =
[RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://api.icndb.com/"]];
objectManager.requestSerializationMIMEType=RKMIMETypeJSON;
[RKObjectManager setSharedManager:objectManager];
.
.
.

eps for CoreData, authentication, etc.)
(There are a few extra st

Tuesday, January 28, 14
Using RestKit: The Mappin
g
RKObjectMapping *jokeMapping = [RKObjectMapping mappingForClass:[Joke class]];
[jokeMapping addAttributeMappingsFromDictionary:@{
@"id":
@"joke":

@"jokeId",
@"text"}];

RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor
responseDescriptorWithMapping:jokeMapping
method:RKRequestMethodGET
pathPattern:@"jokes"
keyPath:@"value"
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

[[RKObjectManager sharedManager] addResponseDescriptor:responseDescriptor];

Tuesday, January 28, 14
I <3 Singletons

a singleton, so
KObjectManager is
R
apping steps need
the setup and m
e, usually at app
only be done onc
launch.
it and forget it. :)
Se t

Tuesday, January 28, 14
Using RestKit: The Call
[[RKObjectManager sharedManager] getObjectsAtPath:@"jokes"
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
self.jokes = mappingResult.array;
[self.tableView reloadData];
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
[self displayError:error];
}];

RKMappingResult has
count,firstObject, array,
dictionary,
and set properties
Tuesday, January 28, 14
Using RestKit: The Mappin
gf

or POST

RKObjectMapping *inverseJokeMapping = [jokeMapping inverseMapping];
RKRequestDescriptor *requestDescriptor = [RKRequestDescriptor
requestDescriptorWithMapping:inverseJokeMapping
objectClass:[Joke class]
rootKeyPath:@"jokes"
method:RKRequestMethodPOST ];
[[RKObjectManager sharedManager] addRequestDescriptor:requestDescriptor];

Tuesday, January 28, 14
it: POSTing
Using RestK
Joke *aJoke=[[Joke alloc] init];
aJoke.jokeId=@9999;
aJoke.text=@"Chuck Norris can find the end of a circle.";
[[RKObjectManager sharedManager] postObject:aJoke
path:@"jokes"
parameters:nil
success:^(RKObjectRequestOperation *operation,
RKMappingResult *mappingResult){}
failure:^(RKObjectRequestOperation *operation,
NSError *error){}];

Tuesday, January 28, 14
ome Demos
S

Tuesday, January 28, 14
Matt Galloway
Architactile
matt@architactile.com
918-808-3072

Tuesday, January 28, 14

More Related Content

What's hot (20)

Object Storage with Gluster
Object Storage with GlusterObject Storage with Gluster
Object Storage with Gluster
Gluster.org
 
2013 PyCon SG - Building your cloud infrastructure with Python
2013 PyCon SG - Building your cloud infrastructure with Python2013 PyCon SG - Building your cloud infrastructure with Python
2013 PyCon SG - Building your cloud infrastructure with Python
George Goh
 
5. configuring multiple switch with files
5. configuring multiple switch with files5. configuring multiple switch with files
5. configuring multiple switch with files
Vishnu Vardhan
 
Blockchain Workshop - Software Freedom Day 2017
Blockchain Workshop - Software Freedom Day 2017Blockchain Workshop - Software Freedom Day 2017
Blockchain Workshop - Software Freedom Day 2017
Zied GUESMI
 
Long Tail Treasure Trove
Long Tail Treasure TroveLong Tail Treasure Trove
Long Tail Treasure Trove
Gianugo Rabellino
 
Pusherアプリの作り方
Pusherアプリの作り方Pusherアプリの作り方
Pusherアプリの作り方
Jun OHWADA
 
Node.js - A Quick Tour II
Node.js - A Quick Tour IINode.js - A Quick Tour II
Node.js - A Quick Tour II
Felix Geisendörfer
 
StackExchange.redis
StackExchange.redisStackExchange.redis
StackExchange.redis
Larry Nung
 
Node.js - A practical introduction (v2)
Node.js  - A practical introduction (v2)Node.js  - A practical introduction (v2)
Node.js - A practical introduction (v2)
Felix Geisendörfer
 
Openstack at NTT Feb 7, 2011
Openstack at NTT Feb 7, 2011Openstack at NTT Feb 7, 2011
Openstack at NTT Feb 7, 2011
Open Stack
 
LinuxKit Swarm Nodes
LinuxKit Swarm NodesLinuxKit Swarm Nodes
LinuxKit Swarm Nodes
Moby Project
 
Ac cuda c_2
Ac cuda c_2Ac cuda c_2
Ac cuda c_2
Josh Wyatt
 
Elastic search
Elastic searchElastic search
Elastic search
Torstein Hansen
 
nodester Architecture overview & roadmap
nodester Architecture overview & roadmapnodester Architecture overview & roadmap
nodester Architecture overview & roadmap
wearefractal
 
Nodester Architecture overview & roadmap
Nodester Architecture overview & roadmapNodester Architecture overview & roadmap
Nodester Architecture overview & roadmap
cmatthieu
 
Kubernetes Tutorial
Kubernetes TutorialKubernetes Tutorial
Kubernetes Tutorial
Ci Jie Li
 
Guillotina: The Asyncio REST Resource API
Guillotina: The Asyncio REST Resource APIGuillotina: The Asyncio REST Resource API
Guillotina: The Asyncio REST Resource API
Nathan Van Gheem
 
DevStack
DevStackDevStack
DevStack
Everett Toews
 
Introduction to Python Asyncio
Introduction to Python AsyncioIntroduction to Python Asyncio
Introduction to Python Asyncio
Nathan Van Gheem
 
속도체크
속도체크속도체크
속도체크
knight1128
 
Object Storage with Gluster
Object Storage with GlusterObject Storage with Gluster
Object Storage with Gluster
Gluster.org
 
2013 PyCon SG - Building your cloud infrastructure with Python
2013 PyCon SG - Building your cloud infrastructure with Python2013 PyCon SG - Building your cloud infrastructure with Python
2013 PyCon SG - Building your cloud infrastructure with Python
George Goh
 
5. configuring multiple switch with files
5. configuring multiple switch with files5. configuring multiple switch with files
5. configuring multiple switch with files
Vishnu Vardhan
 
Blockchain Workshop - Software Freedom Day 2017
Blockchain Workshop - Software Freedom Day 2017Blockchain Workshop - Software Freedom Day 2017
Blockchain Workshop - Software Freedom Day 2017
Zied GUESMI
 
Pusherアプリの作り方
Pusherアプリの作り方Pusherアプリの作り方
Pusherアプリの作り方
Jun OHWADA
 
StackExchange.redis
StackExchange.redisStackExchange.redis
StackExchange.redis
Larry Nung
 
Node.js - A practical introduction (v2)
Node.js  - A practical introduction (v2)Node.js  - A practical introduction (v2)
Node.js - A practical introduction (v2)
Felix Geisendörfer
 
Openstack at NTT Feb 7, 2011
Openstack at NTT Feb 7, 2011Openstack at NTT Feb 7, 2011
Openstack at NTT Feb 7, 2011
Open Stack
 
LinuxKit Swarm Nodes
LinuxKit Swarm NodesLinuxKit Swarm Nodes
LinuxKit Swarm Nodes
Moby Project
 
nodester Architecture overview & roadmap
nodester Architecture overview & roadmapnodester Architecture overview & roadmap
nodester Architecture overview & roadmap
wearefractal
 
Nodester Architecture overview & roadmap
Nodester Architecture overview & roadmapNodester Architecture overview & roadmap
Nodester Architecture overview & roadmap
cmatthieu
 
Kubernetes Tutorial
Kubernetes TutorialKubernetes Tutorial
Kubernetes Tutorial
Ci Jie Li
 
Guillotina: The Asyncio REST Resource API
Guillotina: The Asyncio REST Resource APIGuillotina: The Asyncio REST Resource API
Guillotina: The Asyncio REST Resource API
Nathan Van Gheem
 
Introduction to Python Asyncio
Introduction to Python AsyncioIntroduction to Python Asyncio
Introduction to Python Asyncio
Nathan Van Gheem
 

Similar to Techfest 2013 No RESTKit for the Weary (20)

Beacons, Raspberry Pi & Node.js
Beacons, Raspberry Pi & Node.jsBeacons, Raspberry Pi & Node.js
Beacons, Raspberry Pi & Node.js
Jeff Prestes
 
Beginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCABeginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCA
Whymca
 
iPhone and Rails integration
iPhone and Rails integrationiPhone and Rails integration
iPhone and Rails integration
Paul Ardeleanu
 
RESTfull with RestKit
RESTfull with RestKitRESTfull with RestKit
RESTfull with RestKit
Taras Kalapun
 
Taking Objective-C to the next level. UA Mobile 2016.
Taking Objective-C to the next level. UA Mobile 2016.Taking Objective-C to the next level. UA Mobile 2016.
Taking Objective-C to the next level. UA Mobile 2016.
UA Mobile
 
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Sarp Erdag
 
Multi Client Development with Spring - Josh Long
Multi Client Development with Spring - Josh Long Multi Client Development with Spring - Josh Long
Multi Client Development with Spring - Josh Long
jaxconf
 
I os 13
I os 13I os 13
I os 13
信嘉 陳
 
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docx
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docxcase3h231diamond.gifcase3h231energy.jpgcase3h231moder.docx
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docx
tidwellveronique
 
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
ITGinGer
 
iOS Development Methodology
iOS Development MethodologyiOS Development Methodology
iOS Development Methodology
SmartLogic
 
Network security Lab manual
Network security Lab manual Network security Lab manual
Network security Lab manual
Vivek Kumar Sinha
 
Java9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidadJava9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidad
David Gómez García
 
Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSJavascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJS
Ladislav Prskavec
 
Giving a URL to All Objects using Beacons²
Giving a URL to All Objects using Beacons²Giving a URL to All Objects using Beacons²
Giving a URL to All Objects using Beacons²
All Things Open
 
Eddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsEddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All Objects
Jeff Prestes
 
Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014
Holden Karau
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone Development
Giordano Scalzo
 
Physical web
Physical webPhysical web
Physical web
Jeff Prestes
 
Moar tools for asynchrony!
Moar tools for asynchrony!Moar tools for asynchrony!
Moar tools for asynchrony!
Joachim Bengtsson
 
Beacons, Raspberry Pi & Node.js
Beacons, Raspberry Pi & Node.jsBeacons, Raspberry Pi & Node.js
Beacons, Raspberry Pi & Node.js
Jeff Prestes
 
Beginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCABeginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCA
Whymca
 
iPhone and Rails integration
iPhone and Rails integrationiPhone and Rails integration
iPhone and Rails integration
Paul Ardeleanu
 
RESTfull with RestKit
RESTfull with RestKitRESTfull with RestKit
RESTfull with RestKit
Taras Kalapun
 
Taking Objective-C to the next level. UA Mobile 2016.
Taking Objective-C to the next level. UA Mobile 2016.Taking Objective-C to the next level. UA Mobile 2016.
Taking Objective-C to the next level. UA Mobile 2016.
UA Mobile
 
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Sarp Erdag
 
Multi Client Development with Spring - Josh Long
Multi Client Development with Spring - Josh Long Multi Client Development with Spring - Josh Long
Multi Client Development with Spring - Josh Long
jaxconf
 
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docx
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docxcase3h231diamond.gifcase3h231energy.jpgcase3h231moder.docx
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docx
tidwellveronique
 
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
ITGinGer
 
iOS Development Methodology
iOS Development MethodologyiOS Development Methodology
iOS Development Methodology
SmartLogic
 
Network security Lab manual
Network security Lab manual Network security Lab manual
Network security Lab manual
Vivek Kumar Sinha
 
Java9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidadJava9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidad
David Gómez García
 
Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSJavascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJS
Ladislav Prskavec
 
Giving a URL to All Objects using Beacons²
Giving a URL to All Objects using Beacons²Giving a URL to All Objects using Beacons²
Giving a URL to All Objects using Beacons²
All Things Open
 
Eddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsEddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All Objects
Jeff Prestes
 
Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014
Holden Karau
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone Development
Giordano Scalzo
 

More from Matt Galloway (12)

iOSDistributionOptions
iOSDistributionOptionsiOSDistributionOptions
iOSDistributionOptions
Matt Galloway
 
You Are Here: Exploring mobile proximity awareness with iBeacon
You Are Here: Exploring mobile proximity awareness with iBeaconYou Are Here: Exploring mobile proximity awareness with iBeacon
You Are Here: Exploring mobile proximity awareness with iBeacon
Matt Galloway
 
[iOSDevelopment startAt: squareOne]; @ Tulsa School of Dev 2014
[iOSDevelopment startAt: squareOne]; @ Tulsa School of Dev 2014[iOSDevelopment startAt: squareOne]; @ Tulsa School of Dev 2014
[iOSDevelopment startAt: squareOne]; @ Tulsa School of Dev 2014
Matt Galloway
 
Wire Framing Presentation
Wire Framing PresentationWire Framing Presentation
Wire Framing Presentation
Matt Galloway
 
Everything Staffing Folks Should Know About Mobile Development
Everything Staffing Folks Should Know About Mobile DevelopmentEverything Staffing Folks Should Know About Mobile Development
Everything Staffing Folks Should Know About Mobile Development
Matt Galloway
 
Tulsa TechFest 2013 - StartUp Tulsa
Tulsa TechFest 2013 - StartUp TulsaTulsa TechFest 2013 - StartUp Tulsa
Tulsa TechFest 2013 - StartUp Tulsa
Matt Galloway
 
Tulsa Dev Lunch iOS at Work
Tulsa Dev Lunch iOS at WorkTulsa Dev Lunch iOS at Work
Tulsa Dev Lunch iOS at Work
Matt Galloway
 
How to Hire A Developer
How to Hire A DeveloperHow to Hire A Developer
How to Hire A Developer
Matt Galloway
 
Tulsa Small Business Resources
Tulsa Small Business ResourcesTulsa Small Business Resources
Tulsa Small Business Resources
Matt Galloway
 
Oklahoma Tweets
Oklahoma TweetsOklahoma Tweets
Oklahoma Tweets
Matt Galloway
 
Love 1:46pm twitter event april 22 & 23, 2009
Love 1:46pm twitter event april 22 & 23, 2009Love 1:46pm twitter event april 22 & 23, 2009
Love 1:46pm twitter event april 22 & 23, 2009
Matt Galloway
 
Tulsa Area United Way Agencies' Website Assessment & Recommendations
Tulsa Area United Way Agencies' Website Assessment & RecommendationsTulsa Area United Way Agencies' Website Assessment & Recommendations
Tulsa Area United Way Agencies' Website Assessment & Recommendations
Matt Galloway
 
iOSDistributionOptions
iOSDistributionOptionsiOSDistributionOptions
iOSDistributionOptions
Matt Galloway
 
You Are Here: Exploring mobile proximity awareness with iBeacon
You Are Here: Exploring mobile proximity awareness with iBeaconYou Are Here: Exploring mobile proximity awareness with iBeacon
You Are Here: Exploring mobile proximity awareness with iBeacon
Matt Galloway
 
[iOSDevelopment startAt: squareOne]; @ Tulsa School of Dev 2014
[iOSDevelopment startAt: squareOne]; @ Tulsa School of Dev 2014[iOSDevelopment startAt: squareOne]; @ Tulsa School of Dev 2014
[iOSDevelopment startAt: squareOne]; @ Tulsa School of Dev 2014
Matt Galloway
 
Wire Framing Presentation
Wire Framing PresentationWire Framing Presentation
Wire Framing Presentation
Matt Galloway
 
Everything Staffing Folks Should Know About Mobile Development
Everything Staffing Folks Should Know About Mobile DevelopmentEverything Staffing Folks Should Know About Mobile Development
Everything Staffing Folks Should Know About Mobile Development
Matt Galloway
 
Tulsa TechFest 2013 - StartUp Tulsa
Tulsa TechFest 2013 - StartUp TulsaTulsa TechFest 2013 - StartUp Tulsa
Tulsa TechFest 2013 - StartUp Tulsa
Matt Galloway
 
Tulsa Dev Lunch iOS at Work
Tulsa Dev Lunch iOS at WorkTulsa Dev Lunch iOS at Work
Tulsa Dev Lunch iOS at Work
Matt Galloway
 
How to Hire A Developer
How to Hire A DeveloperHow to Hire A Developer
How to Hire A Developer
Matt Galloway
 
Tulsa Small Business Resources
Tulsa Small Business ResourcesTulsa Small Business Resources
Tulsa Small Business Resources
Matt Galloway
 
Love 1:46pm twitter event april 22 & 23, 2009
Love 1:46pm twitter event april 22 & 23, 2009Love 1:46pm twitter event april 22 & 23, 2009
Love 1:46pm twitter event april 22 & 23, 2009
Matt Galloway
 
Tulsa Area United Way Agencies' Website Assessment & Recommendations
Tulsa Area United Way Agencies' Website Assessment & RecommendationsTulsa Area United Way Agencies' Website Assessment & Recommendations
Tulsa Area United Way Agencies' Website Assessment & Recommendations
Matt Galloway
 

Recently uploaded (20)

Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 

Techfest 2013 No RESTKit for the Weary

  • 1. or the Weary No RestKit f Matt Galloway Architactile [email protected] 918-808-3072 Tuesday, January 28, 14
  • 2. Some Amazingly Cool Data from the “Cloud” ul* Web RESTF es Servic the “Cloud” REST-ish and JSONy. ul,“ of course, I mean * By “RESTF Tuesday, January 28, 14
  • 3. rvice Calls on iOS Web Se Define your URL NSString *url = @”http://somewebservice.com/objects.json”; Make the Call NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; [[NSURLConnection alloc] initWithRequest:request delegate:self]; ese delegate methods!!! Then implement all of th - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error (void)connectionDidFinishLoading:(NSURLConnection *)connection and now you have to parse the JSON in NSData into something useful... Tuesday, January 28, 14
  • 4. n is great, but... NSJSONSerializatio -(void) parseJSONIntoModel:(NSData *) jsonData { NSError *error = nil; NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:&error]; if (error!=nil) { // TODO: Insert annoying JSON error handler here. } if ([json isKindOfClass:[NSArray class]]) { //TODO: Uh. I was expecting a dictionary but apparently this is an array. Writng some handling code here. } for(NSString *key in [json allKeys]) { if ([key isEqualToString:@"user"]) { NSDictionary *userDictionary = [json objectForKey:key]; NSNumber *userId = [userDictionary objectForKey:@"id"]; RKGUser *user = [[ObjectFactory sharedFactory] userForUserId:userId]; if (user==nil) { user = [[ObjectFactory sharedFactory] newUser]; user.userId=useriD; } } . . . user.name = [userDictionary objectForKey:@"name"]; user.username = [userDictionary objectForKey:@"username"]; user.phone = [userDictionary objectForKey:@"phone"]; user.email = [userDictionary objectForKey:@"email"]; Tuesday, January 28, 14
  • 5. nter RestKit E https://github.com/RestK it /RestKit/ ing and modeling ework for consum RestKit is a fram s on iOS and OS X Tful web resource RES Tuesday, January 28, 14
  • 6. [[RKObjectManager sharedManager] getObjectsAtPath:@"objects.json" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) { // Call is successful. Objects are all populated. } failure:^(RKObjectRequestOperation *operation, NSError *error) { // Call failed. }]; Tuesday, January 28, 14
  • 7. RestKit is... rce & available on GitHub * Open Sou * Built on AFNetworking Beautifully multi-threaded * eamlessly with CoreData * Integrates s o works with plain objects * Als lationships, nesting, etc. * Handles re on mapping like an ORM * Based * Very configurable , POST, PATCH, etc. ndles all REST verbs - GET * Ha y actively maintained * Ver ase seeding, search, ch of other stuff - datab * A bu n XML, etc. Tuesday, January 28, 14
  • 8. ing RestKit Install I <3 CocoaPods $ cd /path/to/MyProject $ touch Podfile $ edit Podfile platform :ios, '5.0' # Or platform :osx, '10.7' pod 'RestKit', '~> 0.20.0' $ pod install $ open MyProject.xcworkspace Tuesday, January 28, 14
  • 9. Using RestKit: The W e Tuesday, January 28, 14 b Service
  • 10. Using RestKit: The Object @interface Joke : NSObject @property (nonatomic, strong) NSNumber *jokeId; @property (nonatomic, strong) NSString *text; @end @implementation Joke @end Tuesday, January 28, 14
  • 11. Using RestKit: The Setup -(void) setupRestKit { RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://api.icndb.com/"]]; objectManager.requestSerializationMIMEType=RKMIMETypeJSON; [RKObjectManager setSharedManager:objectManager]; . . . eps for CoreData, authentication, etc.) (There are a few extra st Tuesday, January 28, 14
  • 12. Using RestKit: The Mappin g RKObjectMapping *jokeMapping = [RKObjectMapping mappingForClass:[Joke class]]; [jokeMapping addAttributeMappingsFromDictionary:@{ @"id": @"joke": @"jokeId", @"text"}]; RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:jokeMapping method:RKRequestMethodGET pathPattern:@"jokes" keyPath:@"value" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)]; [[RKObjectManager sharedManager] addResponseDescriptor:responseDescriptor]; Tuesday, January 28, 14
  • 13. I <3 Singletons a singleton, so KObjectManager is R apping steps need the setup and m e, usually at app only be done onc launch. it and forget it. :) Se t Tuesday, January 28, 14
  • 14. Using RestKit: The Call [[RKObjectManager sharedManager] getObjectsAtPath:@"jokes" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) { self.jokes = mappingResult.array; [self.tableView reloadData]; } failure:^(RKObjectRequestOperation *operation, NSError *error) { [self displayError:error]; }]; RKMappingResult has count,firstObject, array, dictionary, and set properties Tuesday, January 28, 14
  • 15. Using RestKit: The Mappin gf or POST RKObjectMapping *inverseJokeMapping = [jokeMapping inverseMapping]; RKRequestDescriptor *requestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:inverseJokeMapping objectClass:[Joke class] rootKeyPath:@"jokes" method:RKRequestMethodPOST ]; [[RKObjectManager sharedManager] addRequestDescriptor:requestDescriptor]; Tuesday, January 28, 14
  • 16. it: POSTing Using RestK Joke *aJoke=[[Joke alloc] init]; aJoke.jokeId=@9999; aJoke.text=@"Chuck Norris can find the end of a circle."; [[RKObjectManager sharedManager] postObject:aJoke path:@"jokes" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult){} failure:^(RKObjectRequestOperation *operation, NSError *error){}]; Tuesday, January 28, 14