Skip to content

Instantly share code, notes, and snippets.

@hookercookerman
Created July 31, 2012 10:36
Show Gist options
  • Save hookercookerman/3215945 to your computer and use it in GitHub Desktop.
Save hookercookerman/3215945 to your computer and use it in GitHub Desktop.
Working RestKit Mapping RubyMotion
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