Created
July 31, 2012 10:36
-
-
Save hookercookerman/3215945 to your computer and use it in GitHub Desktop.
Working RestKit Mapping RubyMotion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Photo | |
attr_accessor :max_id_str | |
URL = "" | |
def self.load | |
manager.loadObjectsAtResourcePath URL, objectMapping:mapping, delegate:self | |
end | |
def self.manager | |
@manager ||= RKObjectManager.managerWithBaseURLString "http://search.twitter.com/search.json?q=.%20For%20example:%20http://search.twitter.com/search.json?q=%40twitterapi" | |
end | |
def self.objectLoader(objectLoader, didLoadObjects:objects) | |
objects.first.max_id_str | |
end | |
def self.objectLoader(objectLoader, didFailWithError:error) | |
puts error | |
end | |
def self.mapping | |
@mapping ||= begin | |
mapping = RKObjectMapping.mappingForClass(Photo) | |
mapping.mapKeyPath "max_id_str", toAttribute:"max_id_str" | |
mapping | |
end | |
end | |
end | |
Photo.load | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment