iPhone and Rails integration
Upcoming SlideShare
Loading in...5
×
 

iPhone and Rails integration

on

  • 4,111 views

ObjectiveResource is an Objective-C port of Ruby on Rails' ActiveResource. It provides a way to serialize objects to and from Rails' standard RESTful web-services (via XML or JSON) and handles much of ...

ObjectiveResource is an Objective-C port of Ruby on Rails' ActiveResource. It provides a way to serialize objects to and from Rails' standard RESTful web-services (via XML or JSON) and handles much of the complexity involved with invoking web-services of any language from the iPhone.
This talk shows you how easy it is to create a 2-way communication channel between a very basic Rails application and an iPhone app.

Statistics

Views

Total Views
4,111
Views on SlideShare
3,856
Embed Views
255

Actions

Likes
4
Downloads
56
Comments
2

9 Embeds 255

http://pardel.net 212
http://www.hello24.com 13
http://hello24.com 13
http://www.slideshare.net 11
http://www.16watts.com 2
https://base.hello24.com 1
http://109.74.204.26 1
http://new.pardel.net 1
http://webcache.googleusercontent.com 1
More...

Accessibility

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

iPhone and Rails integration iPhone and Rails integration Presentation Transcript

  • iP[od|hone|ad] & the tubes Paul Ardeleanu
  • Why? 75m devices to date (iPhone + iPod touch) 140k iPhone apps available 3bn downloads in 18 months Average user spends $8/month There will be a second gold rush Your MD will love it
  • No really, why? Objects are everywhere (NSObject) MVC framework Extremely consistent API Extremely good documentation Easy to pick up
  • Challenges Methods syntax Selectors Memory management (no garbage collection) Autorelease Delegates
  • Exchange data NSURLRequest XML NSURLConnection JSON NSString *url = [NSString stringWithFormat:@"%@%@", @"https://websi.te/contacts.xml", self.path]; NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0]; NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data - (void)connectionDidFinishLoading:(NSURLConnection *)connection - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
  • Objective Resource iphoneonrails.com Objective-C port of Ruby on Rails' ActiveResource
  • Demo
  • Configuration //Set the address of the rails site. The trailing slash is required [ObjectiveResourceConfig setSite:@"http://localhost:3000/"]; //Set the username and password to be used for the remote site [ObjectiveResourceConfig setUser:@"remoteResourceUserName"]; [ObjectiveResourceConfig setPassword:@"remoteResourcePassword"]; [ObjectiveResourceConfig setResponseType:XmlResponse];
  • Model @interface Conference : NSObject { NSString *conferenceId; NSString *name; NSString *location; NSString *startDate; } @property (nonatomic , copy) NSString *conferenceId; @property (nonatomic , copy) NSString *name; @property (nonatomic , copy) NSString *location; @property (nonatomic , copy) NSString *startDate; @end
  • Model @implementation Conference @synthesize conferenceId; @synthesize name; @synthesize location; @synthesize startDate; - (void)dealloc { [conferenceId release]; [name release]; [location release]; [startDate release]; [super dealloc]; } @end
  • Remote methods [Conference findAllRemote]; Conference *conf = [[Conference alloc] init]; [conf saveRemote]; [conf findRemote:45]; [conf updateRemote]; [conf destroyRemote];
  • Thank you! Paul Ardeleanu hello24.com twitter.com/hello24com demo projects available for download at hello24.com